help-make
[Top][All Lists]
Advanced

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

Re: "generating prerequisites automatically" causes all *.d makefiles to


From: Peter Johnson
Subject: Re: "generating prerequisites automatically" causes all *.d makefiles to be regenerated?
Date: Mon, 19 Oct 2009 07:35:17 -0700

Mark,

Unfortunately the GNU Make manual does not recommend the "right thing".

The trick is that you should build the dependencies when you run the compile. They are only needed for the next compile anyway, not the current. Make knew it needed to build foobar.o since it didn't exist. It is only on the next run that it needs the dependency generation.

See http://make.paulandlesley.org/autodep.html for details on how to really do the "right thing".

-Pete

On Oct 19, 2009, at 1:43 AM, Mark Galeck (CW) wrote:

Hello,

I read and implemented the guidelines in the section of the GNU Make manual “4.14 Generating Prerequisities Automatically”. It works great, for each C source file, I have a corresponding .d file, which is also a makefile, generated, and all those makefiles are included in the main makefile with the “include” directive. In the .d file are header file dependencies for that particular C file.

There seems to be a problem however with this approach. I write “seems” because it must be that I don’t understand something, as I am sure the GNU Make manual recommends the “right thing”. Please help me understand what I am missing.



The problem I have is:  when I do
>make foobar.o

make then tries to generate all these *.d files, all of them – not just the one that is needed foobar.d ! That is not good –takes a lot of time if I just want one foobar.o. Also, what is worse,
if I do

>make clean

Then again, all the *.d files are generated first, takes a very long time, before everything is deleted.


How to do it so that only the *.d files that are really needed are generated, and none are generated on make clean?

Thank you for any insight,

Mark
_______________________________________________
Help-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make





reply via email to

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