[CMake] makefile generator

Bill Hoffman bill.hoffman at kitware.com
Wed Apr 18 10:03:05 EDT 2007


Jesper Eskilson wrote:
> Hi all,
>
> I'm curious about the design of the current makefile generator, and
> why it was designed the way it was. I've tried searching the mailing
> list archive, but without any greater success.
>
> One question pops to mind: why invoke use so many levels of recursive
> make? 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. I believe GNU make is smart enough to not start a new process for
> each recursive make, but NMake is definitely not. A ran a quick and
> simple benchmark, showing that the overhead for each nmake invokation
> is at least 0.1-0.2 seconds, which for large projects quickly scales
> up to minutes.
>
> 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.  A single pass make can not check for missing files and 
will
error out if a depend file is deleted.  There are other issues as well, 
but to support
the features, like generated files, not failing to build when .h files 
are removed, it
has to be this way.  gmake can handle some of this stuff, but cmake is meant
to work with any make.  

-Bill



More information about the CMake mailing list