[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

precompiled headers (was: Slow compilation with many files)

From: Brian Dessent
Subject: precompiled headers (was: Slow compilation with many files)
Date: Fri, 18 Apr 2008 02:28:07 -0700

Per Rosengren wrote:

> My only problem now is how to get my buildsystem to use it. I am
> currently using autoconf and automake. If I run "gcc -c myheader.hh", I
> get a myheader.hh.gch file. I have tried to add the headers to
> <target>SOURCES in, but the resulting Makefile doesn't
> compile them.

Anything you write in is simply passed through through
verbatim to the output Makefile in the absence of any automake-specific
syntax, so just write whatever you need as standard make rules.  I'd
start with something like:

BUILT_SOURCES = myheader.hh.gch
%.hh.gch: %.hh
        $(CXX) -c $<

(The %-pattern rule syntax is GNU make specific, so if you need
portability to other makes you would probably need to either spell it
out as "myheader.hh.gch: myheader.hh" or add .hh.gch to .SUFFIXES and
write it as an old-style suffix rule.)

You could also do it at the end of configure using e.g.
first thing done before compiling anything.  The problem with that is
that it won't capture any dependency info, so the .gch will never be
remade if myheader.hh or something it includes is modified.  

But honestly the above is just a random stab at how to start, you'd be
much better asking on the automake list (in CC:.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]