help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automatic prerequisites


From: Alexey Neyman
Subject: Automatic prerequisites
Date: Mon, 11 Apr 2005 12:16:07 +0400
User-agent: KMail/1.6.2

Hi,

the make.info suggests the following way of generating automatic 
dependencies:

     %.d: %.c
              $(CC) -M $(CPPFLAGS) $< > address@hidden; \
              sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < address@hidden > $@; \
              rm -f address@hidden

However, fairly recent GCC has the -MT option that allows to specify 
the targets to be put in the .d file. That is, one could just invoke 

  $ gcc -M -MT 'foo.o foo.d' foo.c

and get the dependencies in the form:

  foo.o foo.d: bar.h baz.h /usr/include/stdio.h

This avoids spawning 2 additional processes and making a temporary 
file. This option is available even in GCC 3.2; I haven't checked the 
releases before it. Why doesn't make suggest using it?

Regards,
Alexey.

-- 
Goodbye, Hunam, I hope you aren't eaten by monsters.
                        -- Spathi captain Fwiffo, SC2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]