This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: dmake, GNU make, gcc, and auto-dependencies
- To: help-gcc at gnu dot org
- Subject: Re: dmake, GNU make, gcc, and auto-dependencies
- From: "Paul D. Smith" <psmith at gnu dot org>
- Date: 06 Dec 1999 10:13:30 -0500
- Newsgroups: gnu.gcc.help,gnu.utils.help
- Organization: Bay Networks, Inc. / Billerica, MA
- References: <384ba7f4.91964227@vic.nnrp.telstra.net>
- Reply-To: psmith at gnu dot org
- Xref: wodc7nx0 gnu.gcc.help:2088 gnu.utils.help:342
%% stus@deimus.com.au (Stuart Summerville) writes:
ss> I'm trying to get auto dependencies working amongst gnu make (V3.76 or
ss> so), dmake (4) and gcc (ver?). The gnu make manual (at www.gnu.org)
ss> suggests creating a pattern rule that will create a .d makefile
ss> (containing dependencies for that file) for each source file, & then
ss> "including" that .d file into the main makefile before the source is
ss> built.
I don't know anything about dmake. But for gmake and GCC, while the
version in the GNU make manual works, it's considered (by me, anyway :)
to be "old technology". There is a much better way to handle
dependencies, invented by Tom Tromey for use in automake. I did a
writeup of it; you can find it on my GNU make webpage below.
ss> Question: How does one stop 'make' from including the .d files if
ss> they're not built yet? For a small 1 file test project (could it be
ss> smaller?), I include the .d file, but its either an old one, or isn't
ss> even built yet.
If you have GNU make 3.76 or better, you can use MAKECMDGOALS for this
(see the manual). If you use the automake method you won't need this,
though.
ss> Another question: The gcc manpage states that the -MD switch will
ss> generate the corresponding .d file, *and* compile the source file. In
ss> doing so, does the contents of the .d file not affect the compilation
ss> of the source file? If not, does that not put the auto-generation of
ss> the dependency rule one step behind in the compilation process? ie.
ss> Shouldn't the generation of the .d file be done in one step, for
ss> subsequent use by make in determining whether to compile the source?
Well, it's not "one step behind" because they're still both done at
essentially the same time (during the same build invocation). It is,
however, less efficient and has a few annoying "features", all of which
are resolved by Tom's method.
--
-------------------------------------------------------------------------------
Paul D. Smith <psmith@gnu.org> Find some GNU make tips at:
http://www.gnu.org http://www.ultranet.com/~pauld/gmake/
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist