From: <sg...@us...> - 2003-11-23 18:45:17
|
Update of /cvsroot/libfunutil/libfunutil/toc/make In directory sc8-pr-cvs1:/tmp/cvs-serv27158 Modified Files: PCH.make Log Message: reworked to allow clients to know if they will be using PCHs or not Index: PCH.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/PCH.make,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- PCH.make 20 Nov 2003 13:45:22 -0000 1.3 +++ PCH.make 23 Nov 2003 18:45:13 -0000 1.4 @@ -1,16 +1,35 @@ #!/do/not/make ############################################################ -# EXPERIMENTAL .gch support (20.11.2003) +# EXPERIMENTAL gcc PCH support (20.11.2003) +# +# Use in conjunction with the gcc_pch toc test. # # Clients must define: # # PRECOMPILED_HEADERS_CXX = list of C++ headers # PRECOMPILED_HEADERS_C = list of C headers # -# Running the PCH target will create *.gch for each *.h +# +# Optionally, set: +# PCH_SUFFIX = filename suffix for PCH files (defaults to .gch). +# +# Running the PCH target will create *$(PCH_SUFFIX) for each *.h +# in PRECOMPILED_HEADERS_{C,CXX}. +# +# After including this file, the variable USE_PCH will be set to 1 if +# the client can expect PCH files to be generated. This can be used, e.g., +# to conditionally add or replace [pre]installed headers with PCH files. +# -PCH_SUFFIX ?= .gch +PCH_MAKEFILE = $(toc_makesdir)/PCH.make + +ifneq (1,$(GCC_SUPPORTS_PCH)) +PCH: + @echo "$(PCH_MAKEFILE): GCC_SUPPORTS_PCH is not set to 1, so PCH support is disabled." +USE_PCH = 0 +else +PCH_SUFFIX ?= .gch COMPILE_COMMAND_CXX_PCH = $(CXX) $(CXXFLAGS) \ $(CPPFLAGS) -xc++ $(TARGET_ARCH) -c -o $(1) $(patsubst %$(PCH_SUFFIX),%,$(1)) @@ -20,7 +39,8 @@ PCH_CXX = $(addsuffix $(PCH_SUFFIX),$(PRECOMPILED_HEADERS_CXX)) - +ifneq (,$(PCH_CXX)) +USE_PCH ?= 1 $(PCH_CXX): ifeq (1,$(configure_build_quietly)) @echo "Precompiling $@..."; \ @@ -28,27 +48,35 @@ else $(call COMPILE_COMMAND_CXX_PCH,$@) endif +endif +# ^^^ PCH_CXX + PCH_C = $(patsubst %.h,%$(PCH_SUFFIX),$(PRECOMPILED_HEADERS_C)) +ifneq (,$(PCH_C)) +USE_PCH ?= 1 $(PCH_C): ifeq (1,$(configure_build_quietly)) - @echo "Precompiling $<..."; \ + @echo "Precompiling $@..."; \ $(call COMPILE_COMMAND_C_PCH,$@) else $(call COMPILE_COMMAND_C_PCH,$@) endif - -# no workie? %$(PCH_SUFFIX): % -PCH_MAKEFILE = $(toc_makesdir)/PCH.make +endif +# ^^^ PCH_C PCH_RULES = .toc.PCH.make $(PCH_RULES): $(PCH_MAKEFILE) Makefile - @echo "Creating precompiled headers rules ($@)..." + @echo "Creating PCH rules." @echo '' > $@ @for x in $(PCH_C) $(PCH_CXX); do \ foo=$$x; foo=$${foo%%$(PCH_SUFFIX)}; \ echo "$$x: $$foo" >> $@; \ done -include $(PCH_RULES) CLEAN_FILES += $(PCH_CXX) $(PCH_C) PCH: $(PCH_RULES) $(PCH_CXX) $(PCH_C) + +endif +# ^^^^^^^ GCC_SUPPORTS_PCH + +USE_PCH ?= 0 |