[Top][All Lists]

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

Re: cost of -MP

From: Noel Yap
Subject: Re: cost of -MP
Date: Thu, 27 May 2004 13:29:46 -0400
User-agent: Mozilla Thunderbird 0.5 (Windows/20040212)

Interesting, non-recursive was slower than recursive.  I suppose I can see this 
happening if there weren't that many directories in the project.  How many 
directories do you have?

Regarding the topic at hand, we don't use -MP, but post-process the output and 
create empty targets for the header files.  For example:


We haven't performed any time comparisons, though.


Boris Kolpackov wrote:

Good day,


I was wondering what is the cost of using -MP option for dependency
generation. In essence, -MP makes gcc output (implicit) PHONY target
for each header to prevent make from flagging header removal as an error.

I have a project of a moderate size: about a hundred C++ translation
units. It takes about 12 minutes to rebuild on a single Intel Pentium M 1.6Ghz. I also have both recursive and non-recursive build systems for this project.

The alternative to -MP that I am considering is to define a do-nothing
terminal pattern rule for headers:

%.h:: ;

To compare these two approaches I run make on an up-to-date project and
measure time it took make to figure out everything is up-to-date. Below
are the results (in seconds):

                  %.h      -MP     r

non-recursive     2.35     3.30    0.40

recursive         1.77     2.51    0.41

Here is the list of drawbacks with the new approach that I am aware of:

 * If some of the headers are generated using pattern rules those rules
   should come before the do-nothing rule. See also

* Some headers (notably ones from C++ standard library) don't have suffixes. There are two observations to consider:

   - headers in system directories don't get removed very often

   - for cases like C++ std lib we can write something like this:

     /usr/include/%:: ;
     /usr/local/include/%:: ;



Help-make mailing list

reply via email to

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