Article View: gnu.utils.bug
Article #1416GNU Make 3.20 problem with recursive makes
From: Andrew Schorr
Date: Mon, 28 Nov 1988 20:22
Date: Mon, 28 Nov 1988 20:22
82 lines
2780 bytes
2780 bytes
Roland,
I am having a problem with recursive makes.
I am running version 3.20 of GNU Make.
Directory /x/y contains Makefile and file1.c
Contents of Makefile:
prog: file1.o ../z/file2.o ../z/file3.o
$(CC) $(LDFLAGS) -o prog $^
../z/file2.o ../z/file3.o: FRC
cd $(@D); $(MAKE) $(@F)
FRC:
There is no file with the name FRC; this is a phony dependency that
is intended to force recompilation.
Directory /x/z contains Makefile, file2.c, file2.h, and file3.c
file2.o: file2.c file2.h
Assume that all the targets are up to date.
When I am in directory /x/y and I type make prog, I would like
make always to invoke the recursive make in directory /x/z for both
file2.o and file3.o. Suppose I type make prog in directory /x/y.
In version 3.13, nothing happened.
In version 3.20, I get
cd ../z/; make file2.o
make: `file2.o' is up to date.
Note that it only performed the recursive make for 1 of the 2 dependencies.
If I type make -n prog, I get the correct behavior:
cd ../z/; make file2.o
make: `file2.o' is up to date.
cd ../z/; make file3.o
make: `file3.o' is up to date.
cc -o prog file1.o ../z/file2.o ../z/file3.o
make: `prog' is up to date.
Now, suppose I switch the order of file2.o and file3.o in /x/y/Makefile:
prog: file1.o ../z/file3.o ../z/file2.o
If I type make prog, I get
cd ../z/; make file3.o
make: `file3.o' is up to date.
It appears that the recursive make is invoked only for the first dependency
in the list (this holds true when there are more than 2 "recursive"
dependencies).
Finally, suppose I change /x/y/Makefile to have the following contents:
prog: file1.o ../z/file2.o ../z/file3.o
$(CC) $(LDFLAGS) -o prog $^
../z/file2.o: FRC
cd $(@D); $(MAKE) $(@F)
FRC:
../z/file3.o: FRC2
cd $(@D); $(MAKE) $(@F)
FRC2:
If I now type make prog, I get the expected behavior:
cd ../z/; make file2.o
make: `file2.o' is up to date.
cd ../z/; make file3.o
make: `file3.o' is up to date.
Two observations:
1. This Makefile works as expected with SunPro 3.5 Make.
2. I realize that I could get this to work using the .PHONY target;
however, I would like to remain compatible with other versions of make.
Thanks for your help,
Andrew Schorr <beareq!schorr@wheaties.ai.mit.edu>
Technical Details
Message-ID:
<8811282022.AA00361@quants4>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!WHEATIES.AI.MIT.EDU!beareq!quants4!schorrShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!WHEATIES.AI.MIT.EDU!beareq!quants4!schorr From: beareq!quants4!schorr@WHEATIES.AI.MIT.EDU (Andrew Schorr) Newsgroups: gnu.utils.bug Subject: GNU Make 3.20 problem with recursive makes Message-ID: <8811282022.AA00361@quants4> Date: 28 Nov 88 20:22:45 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 82