🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.misc
Article #140

Re: bug in make

#140
From: Ron D. Thornton
Date: Mon, 01 Aug 1988 19:55
50 lines
2043 bytes
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
Technical Details
Message-ID: <4919@teddy.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!peregrine!elroy!ames!mailrus!husc6!panda!teddy!rdt
References: <525@jim.odr.oz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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