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

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon Mar 17 19:33:58 EDT 2008


The GNU make documentation states the following:

    Since it knows that phony targets do not name actual files that
    could be remade from other files, make skips the implicit rule search
    for phony targets.... This is why declaring a
    target phony is good for [make] performance....

Also,

    Using .PHONY' is more explicit and more efficient.  However, other
    versions of make' do not support .PHONY'; thus FORCE (an arbitrarily
    named rule with no prerequisites or rules) appears in
    many makefiles.

As part of another investigation I searched a Linux build tree created by
cmake (2.4.8) and was surprised to find no reference to .PHONY. Instead, 
the makefile generator on Linux is using the same method as FORCE idea
above, i.e., a rule called cmake_force with no prerequisites or commands to
serve as a prerequisite to rules that must be run every time.

CMake is missing a bet on Linux systems to reduce Makefile overhead since it
is using this cmake_force approach rather than the preferred more
efficient.PHONY approach for rules that must be run every time.  Since the
Makefiles generated by cmake have an extremely large number of such rules,
Makefile latency may be significantly reduced by this method on Linux (GNU
make) systems.

If the cmake developers here like this idea (or at least don't strongly
dislike it), I will go ahead and make a feature request so it doesn't get
lost.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list