mirror of
https://github.com/gnustep/tools-make.git
synced 2025-04-23 22:33:28 +00:00
Implemented precompiled headers support
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@24360 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ad50612d45
commit
effa404c14
4 changed files with 148 additions and 3 deletions
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
|||
2007-01-16 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
Implemented precompiled headers support. To use them to speed up
|
||||
the compilation of your project, create a main header that you
|
||||
include at the top of each file in your project, then add it to
|
||||
xxx_OBJC_PRECOMPILED_HEADERS and it will automatically be
|
||||
precompiled on platforms that support it.
|
||||
* messages.make (ECHO_PRECOMPILING): New message.
|
||||
* rules.make: New rules to build precompiled headers directory and
|
||||
files.
|
||||
* Instance/rules.make (internal-$(GNUSTEP_TYPE)-all): depend on
|
||||
internal-precompile-headers
|
||||
(xxx_C_PRECOMPILED_HEADERS, xxx_OBJC_PRECOMPILED_HEADERS,
|
||||
xxx_CC_PRECOMPILED_HEADERS, xxx_OBJCC_PRECOMPILED_HEADERS): New
|
||||
variables.
|
||||
(internal-precompile-headers): New rule set to depend on
|
||||
precompiling the precompiled headers, if any. Also, add the
|
||||
precompiled headers directory to ADDITIONAL_INCLUDE_DIRS if the
|
||||
compiler supports precompiled headers and they are being used.
|
||||
|
||||
2007-01-16 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
* configure.ac: Separate out checking gcc version and the test for
|
||||
|
|
|
@ -75,11 +75,13 @@ after-$(GNUSTEP_INSTANCE)-all::
|
|||
# the internal-$(GNUSTEP_TYPE)-all_ rule.
|
||||
|
||||
ifeq ($(COPY_INTO_DIR),)
|
||||
internal-$(GNUSTEP_TYPE)-all:: before-$(GNUSTEP_INSTANCE)-all \
|
||||
internal-$(GNUSTEP_TYPE)-all:: internal-precompile-headers \
|
||||
before-$(GNUSTEP_INSTANCE)-all \
|
||||
internal-$(GNUSTEP_TYPE)-all_ \
|
||||
after-$(GNUSTEP_INSTANCE)-all
|
||||
else
|
||||
internal-$(GNUSTEP_TYPE)-all:: before-$(GNUSTEP_INSTANCE)-all \
|
||||
internal-$(GNUSTEP_TYPE)-all:: internal-precompile-headers \
|
||||
before-$(GNUSTEP_INSTANCE)-all \
|
||||
internal-$(GNUSTEP_TYPE)-all_ \
|
||||
after-$(GNUSTEP_INSTANCE)-all \
|
||||
internal-$(GNUSTEP_TYPE)-copy_into_dir
|
||||
|
@ -171,7 +173,7 @@ endif
|
|||
# The list of JAVA source files from which to generate jni headers
|
||||
# are in the JAVA_JNI_FILES variable.
|
||||
#
|
||||
# This list of WINDRES source files to be compiled
|
||||
# The list of WINDRES source files to be compiled
|
||||
# are in the WINDRES_FILES variable.
|
||||
#
|
||||
|
||||
|
@ -248,6 +250,78 @@ ifeq ($(AUTO_DEPENDENCIES),yes)
|
|||
endif
|
||||
endif
|
||||
|
||||
# The following is for precompiled headers, only executed if GCC
|
||||
# supports them.
|
||||
ifneq ($(GCC_WITH_PRECOMPILED_HEADERS),)
|
||||
#
|
||||
# The following are useful to speed up compilation by using
|
||||
# precompiled headers. If GCC_WITH_PRECOMPILED_HEADERS is '', then
|
||||
# these variables do nothing. If GCC_WITH_PRECOMPILED_HEADERS is yes,
|
||||
# then these variables cause all the listed headers to be precompiled
|
||||
# with the specified compiler before the compilation of the main files
|
||||
# starts; the precompiled files will be put in the
|
||||
# GNUSTEP_OBJ_DIR/PrecompiledHeaders/{language} directory, and
|
||||
# -I$GNUSTEP_OBJ_DIR/PrecompiledHeaders/{language} -Winvalid-pch will
|
||||
# automatically be added to the command line to make sure they are
|
||||
# used.
|
||||
#
|
||||
# The list of C header files to be precompiled is in the
|
||||
# C_PRECOMPILED_HEADERS variable
|
||||
#
|
||||
# The list of Objective-C header files to be precompiled is in the
|
||||
# OBJC_PRECOMPILED_HEADERS variable
|
||||
#
|
||||
# The list of C++ header files to be precompiled is in the
|
||||
# CC_PRECOMPILED_HEADERS variable
|
||||
#
|
||||
# The list of Objective-C++ header files to be precompiled is in the
|
||||
# OBJCC_PRECOMPILED_HEADERS variable
|
||||
#
|
||||
|
||||
C_PRECOMPILED_OBJS = $(patsubst %.h,%.h.gch,$($(GNUSTEP_INSTANCE)_C_PRECOMPILED_HEADERS))
|
||||
C_PRECOMPILED_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/C/,$(C_PRECOMPILED_OBJS))
|
||||
|
||||
OBJC_PRECOMPILED_OBJS = $(patsubst %.h,%.h.gch,$($(GNUSTEP_INSTANCE)_OBJC_PRECOMPILED_HEADERS))
|
||||
OBJC_PRECOMPILED_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjC/,$(OBJC_PRECOMPILED_OBJS))
|
||||
|
||||
CC_PRECOMPILED_OBJS = $(patsubst %.h,%.h.gch,$($(GNUSTEP_INSTANCE)_CC_PRECOMPILED_HEADERS))
|
||||
CC_PRECOMPILED_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/CC/,$(CC_PRECOMPILED_OBJS))
|
||||
|
||||
OBJCC_PRECOMPILED_OBJS = $(patsubst %.h,%.h.gch,$($(GNUSTEP_INSTANCE)_OBJCC_PRECOMPILED_HEADERS))
|
||||
OBJCC_PRECOMPILED_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjCC/,$(OBJCC_PRECOMPILED_OBJS))
|
||||
|
||||
# If any of those variables is not empty
|
||||
ifneq ($(C_PRECOMPILED_OBJ_FILES)$(OBJC_PRECOMPILED_OBJ_FILES)$(CC_PRECOMPILED_OBJ_FILES)$(OBJCC_PRECOMPILED_OBJ_FILES),)
|
||||
# Then we need to build the files before everything else!
|
||||
internal-precompile-headers: $(C_PRECOMPILED_OBJ_FILES)\
|
||||
$(OBJC_PRECOMPILED_OBJ_FILES)\
|
||||
$(CC_PRECOMPILED_OBJ_FILES)\
|
||||
$(OBJCC_PRECOMPILED_OBJ_FILES)
|
||||
|
||||
# We put all the PrecompiledHeaders/xx/ dirs in ADDITIONAL_INCLUDE_DIRS;
|
||||
# gcc can determine which language each file was compiled with, and
|
||||
# will ignore files for different languages.
|
||||
ifneq ($(C_PRECOMPILED_OBJ_FILES),)
|
||||
ADDITIONAL_INCLUDE_DIRS += -I$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/C
|
||||
endif
|
||||
ifneq ($(OBJC_PRECOMPILED_OBJ_FILES),)
|
||||
ADDITIONAL_INCLUDE_DIRS += -I$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjC
|
||||
endif
|
||||
ifneq ($(CC_PRECOMPILED_OBJ_FILES),)
|
||||
ADDITIONAL_INCLUDE_DIRS += -I$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/CC
|
||||
endif
|
||||
ifneq ($(OBJCC_PRECOMPILED_OBJ_FILES),)
|
||||
ADDITIONAL_INCLUDE_DIRS += -I$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjCC
|
||||
endif
|
||||
|
||||
else
|
||||
internal-precompile-headers:
|
||||
endif
|
||||
|
||||
# End of precompiled headers code
|
||||
else
|
||||
internal-precompile-headers:
|
||||
endif
|
||||
|
||||
##
|
||||
## Library and related special flags.
|
||||
|
|
|
@ -32,6 +32,7 @@ ifneq ($(messages),yes)
|
|||
|
||||
# General messages
|
||||
ECHO_PREPROCESSING = @(echo " Preprocessing file $< ...";
|
||||
ECHO_PRECOMPILING = @(echo " Precompiling header file $< ...";
|
||||
ECHO_COMPILING = @(echo " Compiling file $< ...";
|
||||
ECHO_LINKING = @(echo " Linking $(GNUSTEP_TYPE) $(GNUSTEP_INSTANCE) ...";
|
||||
ECHO_JAVAHING = @(echo " Running javah on $< ...";
|
||||
|
@ -89,6 +90,7 @@ ifneq ($(messages),yes)
|
|||
else
|
||||
|
||||
ECHO_PREPROCESSING =
|
||||
ECHO_PRECOMPILING =
|
||||
ECHO_COMPILING =
|
||||
ECHO_LINKING =
|
||||
ECHO_JAVAHING =
|
||||
|
|
49
rules.make
49
rules.make
|
@ -458,6 +458,55 @@ $(GNUSTEP_OBJ_DIR)/%${OEXT} : %.mm
|
|||
$(ALL_OBJCCFLAGS)) \
|
||||
$($<_FILE_FLAGS) -o $@$(END_ECHO)
|
||||
|
||||
ifneq ($(GCC_WITH_PRECOMPILED_HEADERS),)
|
||||
# We put the precompiled headers in different directories (depending
|
||||
# on the language) so that we can easily have different rules (that
|
||||
# use the appropriate compilers/flags) for the different languages.
|
||||
$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/C/%.h.gch : %.h $(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/C/
|
||||
$(ECHO_PRECOMPILING)$(CC) $< -c \
|
||||
$(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
|
||||
$(ALL_CFLAGS)) \
|
||||
$($<_FILE_FLAGS) -o $@$(END_ECHO)
|
||||
|
||||
$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjC/%.h.gch : %.h $(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjC/
|
||||
$(ECHO_PRECOMPILING)$(CC) -x objective-c-header $< -c \
|
||||
$(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
|
||||
$(ALL_OBJCFLAGS)) \
|
||||
$($<_FILE_FLAGS) -o $@$(END_ECHO)
|
||||
|
||||
$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/CC/%.h.gch : %.h $(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/CC/
|
||||
$(ECHO_PRECOMPILING)$(CC) -x c++-header $< -c \
|
||||
$(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
|
||||
$(ALL_CFLAGS) \
|
||||
$(ALL_CCFLAGS)) \
|
||||
$($<_FILE_FLAGS) -o $@$(END_ECHO)
|
||||
|
||||
$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjCC/%h.gch : %.h $(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjCC/
|
||||
$(ECHO_COMPILING)$(CC) -x objective-c++-header $< -c \
|
||||
$(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
|
||||
$(ALL_OBJCCFLAGS)) \
|
||||
$($<_FILE_FLAGS) -o $@$(END_ECHO)
|
||||
|
||||
# These rules create these directories as needed. The directories
|
||||
# (and the precompiled files in them) will automatically be removed
|
||||
# when the GNUSTEP_OBJ_DIR is deleted as part of a clean.
|
||||
$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/C/: $(GNUSTEP_OBJ_DIR)
|
||||
$(ECHO_NOTHING)cd $(GNUSTEP_OBJ_DIR); \
|
||||
$(MKDIRS) ./PrecompiledHeaders/C/$(END_ECHO)
|
||||
|
||||
$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjC/: $(GNUSTEP_OBJ_DIR)
|
||||
$(ECHO_NOTHING)cd $(GNUSTEP_OBJ_DIR); \
|
||||
$(MKDIRS) ./PrecompiledHeaders/ObjC/$(END_ECHO)
|
||||
|
||||
$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/CC/: $(GNUSTEP_OBJ_DIR)
|
||||
$(ECHO_NOTHING)cd $(GNUSTEP_OBJ_DIR); \
|
||||
$(MKDIRS) ./PrecompiledHeaders/CC/$(END_ECHO)
|
||||
|
||||
$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjCC/: $(GNUSTEP_OBJ_DIR)
|
||||
$(ECHO_NOTHING)cd $(GNUSTEP_OBJ_DIR); \
|
||||
$(MKDIRS) ./PrecompiledHeaders/ObjCC/$(END_ECHO)
|
||||
endif
|
||||
|
||||
# FIXME - using a different build dir with java
|
||||
%.class : %.java
|
||||
$(ECHO_COMPILING)$(JAVAC) \
|
||||
|
|
Loading…
Reference in a new issue