Article View: gnu.utils.bug
Article #399Implied PHONY targets in make-3.55 (why?)
From: Dale Nielsen
Date: Fri, 01 Sep 1989 16:28
Date: Fri, 01 Sep 1989 16:28
93 lines
2825 bytes
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
Technical Details
Message-ID:
<7344@vicorp.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!uunet!vicorp!daleShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!uunet!vicorp!dale From: dale@vicorp.UUCP (Dale Nielsen) Newsgroups: gnu.utils.bug Subject: Implied PHONY targets in make-3.55 (why?) Keywords: PHONY make Message-ID: <7344@vicorp.UUCP> Date: 1 Sep 89 16:28:23 GMT Distribution: na Organization: V. I. Corporation, Amherst, Massachusetts Lines: 93