[CMake] makefile generator

Brad King brad.king at kitware.com
Wed Apr 18 10:28:53 EDT 2007


Bill Hoffman wrote:
> Jesper Eskilson wrote:
>> I counted at least three levels on my project, where the leaf
>> make process only compiles a single file (!), where each make process
>> does the complete phase of parsing, building up a dependency tree,
>> etc.

It is not as bad as it looks.  Each recursion level loads a *different*
set of dependencies.  There is almost no overlap among make processes of
the dependencies checked.

The three levels should be:
1.) Top level invoked by user.  Check build system integrity.
2.) Inter-target dependency rules.  Build targets in a valid order.
3.) Intra-target dependency rules for a single target.
    a.) Update generated sources.
        Update implicit dependencies (do scanning if necessary).
    b.) Build sources and link target.

Levels 1 and 2 consist of a total of 1 make process each for the entire
build.  Level 3 consists of 2 make processes for each target.  They have
to be separate because the second process loads dependencies generated
during the first one.

>> Why use recursive make calls at all?
>>
> I will let Brad King answer this in full if he has time.  But basically,
> it has
> to be done this way in order to support correct dependency scanning with
> generated files.

What Bill said is correct.

-Brad


More information about the CMake mailing list