[Top][All Lists]

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

Re: Advanced Auto-Dependency Generation

From: Paul D. Smith
Subject: Re: Advanced Auto-Dependency Generation
Date: Wed, 13 Apr 2005 09:34:20 -0400

%% Alexey Neyman <address@hidden> writes:

  an> I think the following Makefile does just what you want:

  an> %.d %.o: %.c
  an>     gcc -c -MT '$*.o $*.d' -MD -MF $*.d -o $*.o $<

One of the key points of the advanced auto-dependency method is that you
CANNOT have rules that build .d files.  If you do, make will attempt to
build them as included makefiles, which is exactly what you're trying to
AVOID in the advanced method.

%% On Wednesday 13 April 2005 13:44, address@hidden wrote:

  >> But my suggestion is: if you want so much, that the .d (actually
  >> .P) files get regenerated in cases they get deleted - then you
  >> obviously need a rule for them, like the one listed in "Basic
  >> Auto-Dependencies".

But then you're using the "basic auto-dependency" method, not the
advanced auto-dependency method.

See the paper on the problems that occur when you have a rule that
builds .d files.

  >> Also what I dislike about the trick listed in "Advanced
  >> Auto-Dependencies" is that it doesn't work for parallel builds:
  >> there is no rule for .P files.  A process includes a .P file while
  >> it is still being generated by another process and the build fails
  >> (we use pvmgmake here).

I can't speak to the specifics of pvmgmake, but I don't see any way
advanced auto-dependencies conflict with parallel builds.  The makefiles
are all completely parsed BEFORE any rules are invoked, so there's no
way (unless you're running multiple instances of make in the same
directory at the same time, which is going to cause problems no matter
what you do) that the include of the dependency file could conflict with
the generation of that file.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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