From 825da82f389ec835d6aebebed6b40dcddef6632f Mon Sep 17 00:00:00 2001 From: helge Date: Fri, 26 Aug 2005 16:32:04 +0000 Subject: [PATCH] more work on PCH git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1083 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- gnustep-make/ChangeLog | 12 ++++ gnustep-make/GNUmakefile.in | 2 +- gnustep-make/Instance/Shared/headers.make | 41 ------------- gnustep-make/Instance/Shared/pch.make | 74 +++++++++++++++++++++++ gnustep-make/Instance/bundle.make | 5 +- gnustep-make/Instance/library.make | 3 +- gnustep-make/Instance/subproject.make | 2 + gnustep-make/Instance/tool.make | 3 + gnustep-make/Master/bundle.make | 1 + gnustep-make/Master/subproject.make | 1 + gnustep-make/Master/tool.make | 1 + gnustep-make/rules.make | 9 ++- 12 files changed, 107 insertions(+), 47 deletions(-) create mode 100644 gnustep-make/Instance/Shared/pch.make diff --git a/gnustep-make/ChangeLog b/gnustep-make/ChangeLog index 08066269..5f350c14 100644 --- a/gnustep-make/ChangeLog +++ b/gnustep-make/ChangeLog @@ -1,3 +1,15 @@ +2005-08-26 Helge Hess + + * Master/*.make: delete derived sources directory during clean in + relevant project files + + * Instance/*.make: include pch.make in relevant project files + + * GNUmakefile.in: properly install pch.make + + * Instance/Shared/headers.make: moved PCH stuff to an own Shared file + (pch.make) + 2005-08-26 Helge Hess * configure.ac/config.make.in: enable PRECOMPILED_HEADERS if gcc diff --git a/gnustep-make/GNUmakefile.in b/gnustep-make/GNUmakefile.in index 211351a3..d75305a1 100644 --- a/gnustep-make/GNUmakefile.in +++ b/gnustep-make/GNUmakefile.in @@ -98,7 +98,7 @@ INSTANCE_MAKE_FILES = \ test-library.make test-tool.make tool.make INSTANCE_SHARED_MAKE_FILES = bundle.make headers.make java.make \ - stamp-string.make strings.make + stamp-string.make strings.make pch.make INSTANCE_DOC_MAKE_FILES = autogsdoc.make gsdoc.make install_files.make \ javadoc.make latex.make texi.make diff --git a/gnustep-make/Instance/Shared/headers.make b/gnustep-make/Instance/Shared/headers.make index d5b32dc2..aee8f05c 100644 --- a/gnustep-make/Instance/Shared/headers.make +++ b/gnustep-make/Instance/Shared/headers.make @@ -78,47 +78,6 @@ shared-instance-headers-all: else # we have some HEADER_FILES - -# -# PCH file -# - -ifeq ($(PRECOMPILED_HEADERS),yes) -ifneq ($($(GNUSTEP_INSTANCE)_PCH_FILE),) -# has PCH support and PCH file - -$(GNUSTEP_INSTANCE)_GCH_FILE=$(patsubst %.h,%$(GCH_SUFFIX),$($(GNUSTEP_INSTANCE)_PCH_FILE)) - -$(DERIVED_SOURCES_DIR)/$($(GNUSTEP_INSTANCE)_GCH_FILE) :: \ - $(addprefix $(HEADER_FILES_DIR)/,$(HEADER_FILES)) - -PCH_INCLUDE_FLAG=-include $(DERIVED_SOURCES_DIR)/$($(GNUSTEP_INSTANCE)_PCH_FILE) - -shared-instance-headers-all: \ - $(DERIVED_SOURCES_DIR)/$($(GNUSTEP_INSTANCE)_GCH_FILE) - -shared-instance-headers-clean: - $(RM) $(DERIVED_SOURCES_DIR)/$($(GNUSTEP_INSTANCE)_GCH_FILE) - -else # no PCH file defined - -shared-instance-headers-all: - @(echo "no PCH file: $(GNUSTEP_INSTANCE)_PCH_FILE" ) - -shared-instance-headers-clean: - -endif - -else # no PCH in compiler - -shared-instance-headers-all: - @(echo "no PCH support in compiler .." ) - -shared-instance-headers-clean: - -endif # no PCH in compiler - - # # We provide two different algorithms of installing headers. # diff --git a/gnustep-make/Instance/Shared/pch.make b/gnustep-make/Instance/Shared/pch.make new file mode 100644 index 00000000..ba375298 --- /dev/null +++ b/gnustep-make/Instance/Shared/pch.make @@ -0,0 +1,74 @@ +# +# Shared/headers.make +# +# Makefile fragment with rules to install header files +# +# Copyright (C) 2002 Free Software Foundation, Inc. +# +# Author: Nicola Pero +# +# This file is part of the GNUstep Makefile Package. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# You should have received a copy of the GNU General Public +# License along with this library; see the file COPYING.LIB. +# If not, write to the Free Software Foundation, +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# +# input variables: +# +# TODO: document +# + +# +# public targets: +# +# shared-instance-pch-all +# shared-instance-pch-clean +# + +ifeq ($(PRECOMPILED_HEADERS),yes) + +ifneq ($($(GNUSTEP_INSTANCE)_PCH_FILE),) + +# has PCH support and PCH file + +# we need to use notdir() because sometimes subprojects refer to a header +# in the directory above (eg: MySubproject_PCH_FILE=../common.h) +# BUT: if I add 'notdir()' the .h=>.gch in rules.make doesn't work anymore? +$(GNUSTEP_INSTANCE)_GCH_FILE=\ + $(patsubst %.h,%$(GCH_SUFFIX),$($(GNUSTEP_INSTANCE)_PCH_FILE)) + +ifneq ($($(GNUSTEP_INSTANCE)_PCH_AUTOINCLUDE),no) +PCH_INCLUDE_FLAG=\ + -include $(DERIVED_SOURCES_DIR)/$(notdir $($(GNUSTEP_INSTANCE)_PCH_FILE)) +endif + +shared-instance-pch-all: \ + $(DERIVED_SOURCES_DIR)/$($(GNUSTEP_INSTANCE)_GCH_FILE) + +shared-instance-pch-clean: + $(RM) $(DERIVED_SOURCES_DIR)/$($(GNUSTEP_INSTANCE)_GCH_FILE) + +else # no PCH file defined + +shared-instance-pch-all: + @(echo "No PCH file declared: $(GNUSTEP_INSTANCE)_PCH_FILE" ) + +shared-instance-pch-clean: + +endif + +else # no PCH in compiler + +shared-instance-pch-all: + @(echo "No PCH support in compiler." ) + +shared-instance-pch-clean: + +endif # no PCH in compiler diff --git a/gnustep-make/Instance/bundle.make b/gnustep-make/Instance/bundle.make index 766e3bd5..4b0b3e35 100644 --- a/gnustep-make/Instance/bundle.make +++ b/gnustep-make/Instance/bundle.make @@ -26,6 +26,7 @@ include $(GNUSTEP_MAKEFILES)/rules.make endif include $(GNUSTEP_MAKEFILES)/Instance/Shared/headers.make +include $(GNUSTEP_MAKEFILES)/Instance/Shared/pch.make # The name of the bundle is in the BUNDLE_NAME variable. # The list of bundle resource file are in xxx_RESOURCE_FILES @@ -104,7 +105,9 @@ endif # OBJ_FILES_TO_LINK # apple. # -internal-bundle-all_:: $(GNUSTEP_OBJ_DIR) build-bundle +internal-bundle-all_:: $(GNUSTEP_OBJ_DIR) \ + shared-instance-pch-all \ + build-bundle BUNDLE_DIR_NAME = $(GNUSTEP_INSTANCE:=$(BUNDLE_EXTENSION)) BUNDLE_DIR = $(GNUSTEP_BUILD_DIR)/$(BUNDLE_DIR_NAME) diff --git a/gnustep-make/Instance/library.make b/gnustep-make/Instance/library.make index 194e0054..e26d7a2b 100644 --- a/gnustep-make/Instance/library.make +++ b/gnustep-make/Instance/library.make @@ -26,6 +26,7 @@ include $(GNUSTEP_MAKEFILES)/rules.make endif include $(GNUSTEP_MAKEFILES)/Instance/Shared/headers.make +include $(GNUSTEP_MAKEFILES)/Instance/Shared/pch.make # # The name of the library (including the 'lib' prefix) is @@ -306,7 +307,7 @@ $(GNUSTEP_OBJ_DIR)/$(DLL_NAME): $(OBJ_FILES_TO_LINK) \ else # following code for anything but OLD_DLL_SUPPORT internal-library-all_:: $(GNUSTEP_OBJ_DIR) \ - shared-instance-headers-all \ + shared-instance-pch-all \ $(GNUSTEP_OBJ_DIR)/$(VERSION_LIBRARY_FILE) $(GNUSTEP_OBJ_DIR)/$(VERSION_LIBRARY_FILE): $(OBJ_FILES_TO_LINK) diff --git a/gnustep-make/Instance/subproject.make b/gnustep-make/Instance/subproject.make index 0e8abc66..b249333c 100644 --- a/gnustep-make/Instance/subproject.make +++ b/gnustep-make/Instance/subproject.make @@ -32,6 +32,7 @@ endif # Compilation targets # internal-subproject-all_:: $(GNUSTEP_OBJ_DIR) \ + shared-instance-pch-all \ $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) ifeq ($(BUILD_DLL),yes) @@ -105,6 +106,7 @@ else # include $(GNUSTEP_MAKEFILES)/Instance/Shared/headers.make +include $(GNUSTEP_MAKEFILES)/Instance/Shared/pch.make internal-subproject-install_:: shared-instance-headers-install diff --git a/gnustep-make/Instance/tool.make b/gnustep-make/Instance/tool.make index 622fa651..bd9cd4c4 100644 --- a/gnustep-make/Instance/tool.make +++ b/gnustep-make/Instance/tool.make @@ -30,6 +30,8 @@ ifeq ($(RULES_MAKE_LOADED),) include $(GNUSTEP_MAKEFILES)/rules.make endif +include $(GNUSTEP_MAKEFILES)/Instance/Shared/pch.make + .PHONY: internal-tool-all_ \ internal-tool-install_ \ internal-tool-uninstall_ \ @@ -69,6 +71,7 @@ ALL_TOOL_LIBS = \ # Compilation targets # internal-tool-all_:: $(GNUSTEP_OBJ_DIR) \ + shared-instance-pch-all \ $(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT) $(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT): $(OBJ_FILES_TO_LINK) diff --git a/gnustep-make/Master/bundle.make b/gnustep-make/Master/bundle.make index d75bb2f5..4375a808 100644 --- a/gnustep-make/Master/bundle.make +++ b/gnustep-make/Master/bundle.make @@ -40,6 +40,7 @@ internal-clean:: (cd $(GNUSTEP_BUILD_DIR); \ rm -rf $(GNUSTEP_OBJ_DIR_NAME) $(_PSWRAP_C_FILES) $(_PSWRAP_H_FILES) \ $(addsuffix $(BUNDLE_EXTENSION),$(BUNDLE_NAME))) + rm -rf $(DERIVED_SOURCES_DIR) internal-distclean:: (cd $(GNUSTEP_BUILD_DIR); \ diff --git a/gnustep-make/Master/subproject.make b/gnustep-make/Master/subproject.make index 0e10886e..a3675eca 100644 --- a/gnustep-make/Master/subproject.make +++ b/gnustep-make/Master/subproject.make @@ -54,6 +54,7 @@ _PSWRAP_H_FILES = $($(SUBPROJECT_NAME)_PSWRAP_FILES:.psw=.h) internal-clean:: (cd $(GNUSTEP_BUILD_DIR); \ rm -rf $(GNUSTEP_OBJ_DIR_NAME) $(_PSWRAP_C_FILES) $(_PSWRAP_H_FILES)) + rm -rf $(DERIVED_SOURCES_DIR) internal-distclean:: (cd $(GNUSTEP_BUILD_DIR); \ diff --git a/gnustep-make/Master/tool.make b/gnustep-make/Master/tool.make index 1deda758..d8186e8a 100644 --- a/gnustep-make/Master/tool.make +++ b/gnustep-make/Master/tool.make @@ -34,6 +34,7 @@ internal-uninstall:: $(TOOL_NAME:=.uninstall.tool.variables) internal-clean:: rm -rf $(GNUSTEP_OBJ_DIR) + rm -rf $(DERIVED_SOURCES_DIR) internal-distclean:: (cd $(GNUSTEP_BUILD_DIR); \ diff --git a/gnustep-make/rules.make b/gnustep-make/rules.make index 6493106f..5676b4aa 100644 --- a/gnustep-make/rules.make +++ b/gnustep-make/rules.make @@ -430,12 +430,15 @@ $(GNUSTEP_OBJ_DIR)/%${OEXT} : %.cp $(ALL_CCFLAGS)) \ $($<_FILE_FLAGS) -o $@$(END_ECHO) -# precompiled header files (TODO: should go into GNUSTEP_OBJ_DIR?) +# precompiled header files +# TODO: should go into GNUSTEP_OBJ_DIR? +# TODO: we need to create the derived_src here because there is no rule yet +# in the include path? GCH_SUFFIX=.h.gch $(DERIVED_SOURCES_DIR)/%$(GCH_SUFFIX): %.h - if ! test -d $(DERIVED_SOURCES_DIR); then \ + $(ECHO_NOTHING)if ! test -d $(DERIVED_SOURCES_DIR); then \ $(MKDIRS) $(DERIVED_SOURCES_DIR); \ - fi + fi$(END_ECHO) $(ECHO_COMPILING)$(CC) -x objective-c-header $< -c \ $(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \ $(ALL_OBJCFLAGS)) \ -- 2.39.5