[CMake] makefile generator

Jesper Eskilson jesper at eskilson.se
Thu Apr 19 02:32:07 EDT 2007


2007/4/18, Bill Hoffman <bill.hoffman at kitware.com>:
> 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
>
>

Can you (or anyone else) elaborate on this? What features are abscent
from other makes which are necessary to avoid recursive make calls?
I've got a fair amount of experience of writing complex makefiles for
gmake, but very little experience with other makes.

I like fast incremental builds over the entire project, i.e. I would
like to be able to do "make all' and have it completed in under 2-3
seconds. In Visual Studio this is impossible, but my hope was the that
Makefile generator could get me somewhere around that mark.

(I'm trying to figure out how much effort it would be to write my own
generator, but I'm not sure what backend build engine I should target,
if I should write it from scratch, or try to adapt one of the existing
generators).

Anyway, despite some of its quirks, CMake is great. The simple fact
that cmake gets me away from visual studio project files is worth
alot.

-- 
/Jesper


More information about the CMake mailing list