[CMake] Obtaining improved GNU make performance on Makefiles generated by cmake

Bill Hoffman bill.hoffman at kitware.com
Tue Mar 18 09:03:25 EDT 2008


Alan W. Irwin wrote:

> To summarize, the above quote from GNU make documentation shows they were
> concerned about the latency of the "force" alternative to .PHONY. If you
> have ever run GNU make in debug mode, there is a lot of stuff it goes
> through to look for implicit rules that fit the target so for the very 
> large
> number of Makefile targets that CMake generates that are not files, 
> there is
> a lot of unneeded implicit rule checking going on.  That work would be
> completely eliminated by appropriate use of .PHONY, and because so many
> rules are involved, I suspect that would give a significant reduction in
> latency.
> 


We used to have something that removed many implicit rules.  I think 
that got lost in some version of CMake, it is hard to test...   I did 
find that there is a command line option to gmake, -r that turns off 
implicit rules. I am seeing a speed up with gmake -r.   Would it work to 
turn off all implicit rules instead of the .PHONY stuff?  CMake does not 
use any implicit rules anyway.  I think the only way to turn them off is 
to redefine them as empty rules.  This works for all make, and not just 
gmake.  I am trying to figure out what implicit rules need to be turned 
off and how to turn them off.  Any ideas?


-Bill



More information about the CMake mailing list