Path: utzoo!attcan!uunet!peregrine!elroy!ames!mailrus!husc6!panda!teddy!rdt From: rdt@teddy.UUCP (Ron D. Thornton) Newsgroups: comp.bugs.misc Subject: Re: bug in make Keywords: make subdirectories BUG Message-ID: <4919@teddy.UUCP> Date: 1 Aug 88 19:55:10 GMT References: <525@jim.odr.oz> Reply-To: rdt@teddy.UUCP (Ron D. Thornton) Organization: GenRad, Inc., Concord, Mass. Lines: 50 In article <525@jim.odr.oz> brw@jim.odr.oz (Brian Wallis) writes: > >Is this a bug in make, or am I just missing something obvious? >The simple example for the make file is as follows... > >| >| exe: file1.o >| ld -o exe file1.o >| >| file1.o: dir1/file1.c >| > ... > I expect >the default '.c.o:' rule to be used to generate the file 'file1.o' >from ./dir1/file1.c. ... >*** Note: that file1.o DOES NOT exist but a time is returned which > is later that that returned for dir1/file1.c !!! *** ... >| 129% make -d -i exe >| doname(exe,0) >| doname(file1.o,1) >| doname(dir1/file1.c,2) >| TIME(dir1/file1.c)=585550307 >| TIME(file1.o)=585559519 <<< where the hell does this time come from!!!! >| ld -o exe file1.o >| ld:file1.o: cannot open Make has some subtle things going on. '.c.o' is an inferred or implicit rule, NOT a default rule. Inferred rules are only used when make constructs an inferred 'prerequisite' from the .SUFFIX list. Since you supplied a dependency line AND make could not build an inferred prerequisite from the .SUFFIX list, make assumed the target (file1.o) was successful and therefore assigned the current time to it. This allows constructs like: all: program_a program_b program_c to work without getting an error because the target "all" never really exists. I think you are stuck with specifying explicit rules if you move the source out of the current directory. You might think about putting the Makefile in with the sources and objects, just pushing the exe's into something other than the current directory. -Ron- rdt@genrad.com