🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Dale Nielsen Fri, 01 Sep 1989 16:28
Implied PHONY targets in make-3.55 (why?)
#399
Author: Dale Nielsen
Date: Fri, 01 Sep 1989 16:28
93 lines
2825 bytes
I have a problem with the way gnu-make-3.55 identifies
implied phony targets.  A target with no dependencies that
has rules associated with it is assumed to be a phony target
even though it is not declared as one.

I use file targets without dependencies in my makefiles to
create directories that only need to exist, not "updated".

Consider the following makefile:

#######################
.PHONY : all

all : dir/foo dir/bar

dir/foo : dir
	touch $@

dir/bar : dir
	touch $@

dir :
	mkdir $@
#######################

The first time this is run we get:

mkdir dir
touch dir/foo
touch dir/bar

Which is ok.


The second time we get:

mkdir dir
mkdir: dir: File exists


Why should make update dir?  It isn't a phony target and it
does exist so it shouldn't be remade.

Here is the diff -c output for what I changed in order to
fix it:

############################################################################

*** remake.c    Fri Sep  1 12:05:40 1989
--- remake.c.orig       Tue Aug 22 05:21:12 1989
***************
*** 449,464 ****
    /* Here depth returns to the value it had when we were called.  */
    depth--;
  
- #ifdef IMPLIED_PHONY_TARGETS
    if (file->deps == 0 && file->cmds != 0)
      {
        must_make = 1;
        DEBUGPR ("Target `%s' has commands but no dependencies.\n");
      }
!   else 
! #endif IMPLIED_PHONY_TARGETS
! 
!   if (!deps_changed && file->cmds == 0)
      {
        must_make = 0;
        DEBUGPR ("No commands for `%s' and no dependencies actually changed.\n");
--- 449,460 ----
    /* Here depth returns to the value it had when we were called.  */
    depth--;
  
    if (file->deps == 0 && file->cmds != 0)
      {
        must_make = 1;
        DEBUGPR ("Target `%s' has commands but no dependencies.\n");
      }
!   else if (!deps_changed && file->cmds == 0)
      {
        must_make = 0;
        DEBUGPR ("No commands for `%s' and no dependencies actually changed.\n");

############################################################################

It seems to me that there should be no
implied PHONY targets, but I want to be sure I'm not
screwing something else up by doing this.  Comments?
-- 
	--Dale Nielsen				ARPA:  dale@vicorp.UU.NET
	  V. I. Corporation			UUCP:  uunet!vicorp!dale
	  Amherst Research Park			PHONE: (413) 253-3482
	  Amherst, Massachusetts  01002		FAX:   (413) 256-0574
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads