Article View: comp.bugs.misc
Article #138Re: bug in make
From: Chris Torek
Date: Mon, 01 Aug 1988 06:32
Date: Mon, 01 Aug 1988 06:32
44 lines
2003 bytes
2003 bytes
>In article <525@jim.odr.oz> brw@jim.odr.oz (Brian Wallis) writes:
>>[sample simple makefile]
>>| exe: file1.o
>>| ld -o exe file1.o
>>|
>>| file1.o: dir1/file1.c
>>'Makefile' is in '.' and the file 'file1.c' is in './dir1'.
>>I want to make the file 'exe' from 'file1.o' in '.' where 'file1.o'
>>depends on './dir1/file1.c' as is stated in the Makefile. I expect
>>the default '.c.o:' rule to be used to generate the file 'file1.o'
Good so far;
>>from ./dir1/file1.c.
oops.
In article <284@sagpd1.UUCP> banderso@sagpd1.UUCP (Bruce Anderson) writes:
>[make] goes out to itts implicit rule base
>and looks for a way to generate test.o. It however, *TOTALLY IGNORES*
>the test.c filename on the dependency line and generates the source
>file name from the target file name.
This is right, but a bit misleading. Here is another makefile:
foo: foo.o
ld -o $@ foo.o
foo.o: dir/foo.c
${CC} -c ${CFLAGS} $*.c
This one has as an explicit line the same rule that appears in the
default .c.o. The point is that $*.c (or $<, which works only in
generic rules, so I actually modified the rule a bit) expands to
`foo.c', not `dir/foo.c'. The names of the files upon which foo.o
depends are irrelevant; they have nothing to do with the expansion
of the various macros.
Solutions to the original problem? Unless you have VPATH, there
are no nice ones. Make does not deal well with directories.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris
Technical Details
Message-ID:
<12773@mimsy.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!umd5!mimsy!chrisReferences:
<525@jim.odr.oz> <284@sagpd1.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!umd5!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.bugs.misc Subject: Re: bug in make Keywords: make subdirectories BUG Message-ID: <12773@mimsy.UUCP> Date: 1 Aug 88 06:32:33 GMT References: <525@jim.odr.oz> <284@sagpd1.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 44