The compiler flags given when compiling a source file that uses a
precompiled header must match those used when the precompiled header was
compiled. Because of this I altered Brian's code to:
BUILT_SOURCES = myheader.hh.gch
%.hh.gch: %.hh
$(CXXCOMPILE) -c $<
The only difference here is that CXXCOMPILE - which is used to compile
my sources, adds some flags to CXX.
For debugging purposes, I added
AM_CXXFLAGS = -H -Winvalid-pch
where -H prints all header files included, and -Winvalid-pch warns if a
precompiled header was found but not used.
I think all dependencies are correct.
Thank you!
Per
Ralf Wildenhues wrote:
* Brian Dessent wrote on Fri, Apr 18, 2008 at 11:28:07AM CEST:
BUILT_SOURCES = myheader.hh.gch
%.hh.gch: %.hh
$(CXX) -c $<
[...]
The rule is a good start, but likely lacking dependency information.
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:.)
My humble musings about precompiled headers support are mostly in
<http://thread.gmane.org/gmane.comp.gcc.devel/60371>, and those
affect GCC-type precompiled headers only.
Cheers,
Ralf