help-make
[Top][All Lists]
Advanced

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

cost of -MP


From: Boris Kolpackov
Subject: cost of -MP
Date: Wed, 12 May 2004 12:15:47 -0500
User-agent: Mutt/1.5.6i

Good day,

JFYI:

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

   http://mail.gnu.org/archive/html/help-make/2004-02/msg00015.html


 * 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/%:: ;


comments?
-boris

Attachment: signature.asc
Description: Digital signature


reply via email to

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