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:
my_header:
We haven't performed any time comparisons, though.
Noel
Boris Kolpackov wrote:
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
------------------------------------------------------------------------
_______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
_______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
