Store object files for gdomap in ./obj/gdomap.obj/ instead of simply ./obj/ to make it safe to parallel build multiple instances of everything

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@29571 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2010-02-12 09:19:25 +00:00
parent d5b804f00a
commit 44fb9c993e
16 changed files with 168 additions and 109 deletions

View file

@ -1,3 +1,43 @@
2010-02-12 Nicola Pero <nicola.pero@meta-innovation.com>
Create separate directories to store the object files of each
instance. This allows to safely parallelize building different
instances.
* common.make (GNUSTEP_OBJ_INSTANCE_DIR,
GNUSTEP_OBJ_INSTANCE_DIR_NAME): New variables.
* rules.make: Include rules to compile C/ObjC/C++/ObjC++/.rc and
to precompile headers only in the Instance invocation. Updated
all rules to store object files into GNUSTEP_OBJ_INSTANCE_DIR
instead of GNUSTEP_OBJ_DIR.
* Instance/rules.make (GNUSTEP_OBJ_INSTANCE_DIR): New rule.
Updated the whole file to put all object files in
GNUSTEP_OBJ_INSTANCE_DIR instead of GNUSTEP_OBJ_DIR.
(OBJ_DIRS_TO_CREATE): Do not ignore failures any more when
building in parallel.
* Instance/application.make (internal-app-all_): Depend on
GNUSTEP_OBJ_INSTANCE_DIR instead of GNUSTEP_OBJ_DIR.
* Instance/bundle.make: Same change.
* Instance/ctool.make: Same change.
* Instance/framework.make: Same change.
* Instance/gswapp.make: Same change.
* Instance/gswbundle.make: Same change.
* Instance/library.make: Same change.
* Instance/objc.make: Same change.
* Instance/palette.make: Same change.
* Instance/service.make: Same change.
* Instance/subproject.make: Same change.
* Instance/tool.make: Same change.
* Instance/framework.make (DUMMY_FRAMEWORK_OBJ_FILE): Put
DUMMY_FRAMEWORK_OBJ_FILE inside GNUSTEP_OBJ_INSTANCE_DIR instead
of GNUSTEP_OBJ_DIR.
* Instance/ctool.make
($(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)): Do not depend
on OBJC_DIRS_TO_CREATE.
* Instance/rules.make (OBJ_FILES_TO_LINK_THAT_WE_CREATE): New
variable used to prevent spurious attempts to create subproject
object directories.
2010-02-12 Nicola Pero <nicola.pero@meta-innovation.com>
* Instance/clibrary.mak: Added "# -*-makefile-*-" on the first

View file

@ -3,9 +3,9 @@
#
# Instance Makefile rules to build GNUstep-based applications.
#
# Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc.
# Copyright (C) 1997 - 2010 Free Software Foundation, Inc.
#
# Author: Nicola Pero <nicola@brainstorm.co.uk>
# Author: Nicola Pero <nicola.pero@meta-innovation.com>
# Author: Ovidiu Predescu <ovidiu@net-community.com>
# Based on the original version by Scott Christley.
#
@ -154,7 +154,7 @@ internal-app-compile: $(APP_FILE)
endif
ifeq ($(FOUNDATION_LIB), apple)
internal-app-all_:: $(GNUSTEP_OBJ_DIR) \
internal-app-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) \
$(OBJ_DIRS_TO_CREATE) \
$(APP_DIR)/Contents/MacOS \
internal-app-run-compile-submake \
@ -173,7 +173,7 @@ $(APP_DIR)/Contents/MacOS:
else
internal-app-all_:: $(GNUSTEP_OBJ_DIR) \
internal-app-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) \
$(OBJ_DIRS_TO_CREATE) \
$(APP_DIR)/$(GNUSTEP_TARGET_LDIR) \
internal-app-run-compile-submake \

View file

@ -107,7 +107,7 @@ endif # OBJ_FILES_TO_LINK
# apple.
#
internal-bundle-all_:: $(GNUSTEP_OBJ_DIR) $(OBJ_DIRS_TO_CREATE) build-bundle
internal-bundle-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) $(OBJ_DIRS_TO_CREATE) build-bundle
# If they specified Info-gnustep.plist in the xxx_RESOURCE_FILES,
# print a warning. They are supposed to provide a xxxInfo.plist which
# gets merged with the automatically generated entries to generate

View file

@ -63,14 +63,14 @@ ALL_LIBS = \
#
ifeq ($(GNUSTEP_MAKE_PARALLEL_BUILDING), no)
# Standard building
internal-ctool-all_:: $(GNUSTEP_OBJ_DIR) \
internal-ctool-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) \
$(OBJ_DIRS_TO_CREATE) \
$(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)
else
# Parallel building. The actual compilation is delegated to a
# sub-make invocation where _GNUSTEP_MAKE_PARALLEL is set to yet.
# That sub-make invocation will compile files in parallel.
internal-ctool-all_:: $(GNUSTEP_OBJ_DIR) $(OBJ_DIRS_TO_CREATE)
internal-ctool-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) $(OBJ_DIRS_TO_CREATE)
$(ECHO_NOTHING)$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory --no-keep-going \
internal-ctool-compile \
GNUSTEP_TYPE=$(GNUSTEP_TYPE) \
@ -82,7 +82,7 @@ internal-ctool-all_:: $(GNUSTEP_OBJ_DIR) $(OBJ_DIRS_TO_CREATE)
internal-ctool-compile: $(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)
endif
$(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT): $(OBJ_DIRS_TO_CREATE) $(OBJ_FILES_TO_LINK)
$(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT): $(OBJ_FILES_TO_LINK)
ifeq ($(OBJ_FILES_TO_LINK),)
$(WARNING_EMPTY_LINKING)
endif

View file

@ -216,7 +216,7 @@ ifeq ($(FOUNDATION_LIB),gnu)
DUMMY_FRAMEWORK = NSFramework_$(subst +,_1,$(subst -,_0,$(subst _,__,$(GNUSTEP_INSTANCE))))
DUMMY_FRAMEWORK_FILE = $(DERIVED_SOURCES_DIR)/$(DUMMY_FRAMEWORK).m
DUMMY_FRAMEWORK_OBJ_FILE = $(addprefix $(GNUSTEP_OBJ_DIR)/,$(DUMMY_FRAMEWORK).o)
DUMMY_FRAMEWORK_OBJ_FILE = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(DUMMY_FRAMEWORK).o)
# The following file will hold the list of classes compiled into the
# framework, ready to be included in the .plist file. We include the
@ -331,7 +331,7 @@ endif
GNUSTEP_SHARED_BUNDLE_RESOURCE_PATH = $(FRAMEWORK_VERSION_DIR)/Resources
include $(GNUSTEP_MAKEFILES)/Instance/Shared/bundle.make
internal-framework-all_:: $(GNUSTEP_OBJ_DIR) $(OBJ_DIRS_TO_CREATE) \
internal-framework-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) $(OBJ_DIRS_TO_CREATE) \
build-framework
# If they specified Info-gnustep.plist in the xxx_RESOURCE_FILES,
# print a warning. They are supposed to provide a xxxInfo.plist which

View file

@ -123,7 +123,7 @@ endif
#
ifeq ($(FOUNDATION_LIB), apple)
internal-gswapp-all_:: \
$(GNUSTEP_OBJ_DIR) \
$(GNUSTEP_OBJ_INSTANCE_DIR) \
$(OBJ_DIRS_TO_CREATE) \
$(GSWAPP_DIR)/Contents/MacOS \
$(GSWAPP_FILE) \
@ -134,7 +134,7 @@ $(GSWAPP_DIR)/Contents/MacOS:
$(ECHO_CREATING)$(MKDIRS) $@$(END_ECHO)
else
internal-gswapp-all_:: $(GNUSTEP_OBJ_DIR) \
internal-gswapp-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) \
$(OBJ_DIRS_TO_CREATE) \
$(GSWAPP_DIR)/$(GNUSTEP_TARGET_LDIR) \
$(GSWAPP_FILE) \

View file

@ -91,7 +91,7 @@ endif
# How about the rest of the systems? ALL_BUNDLE_LIBS is temporary empty.
#ALL_GSWBUNDLE_LIBS = $(ADDITIONAL_GSW_LIBS) $(AUXILIARY_GSW_LIBS) $(GSW_LIBS) $(ALL_LIBS)
internal-gswbundle-all_:: $(GNUSTEP_OBJ_DIR) \
internal-gswbundle-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) \
$(OBJ_DIRS_TO_CREATE) \
build-bundle-dir \
build-bundle

View file

@ -257,14 +257,14 @@ endif
#
ifeq ($(GNUSTEP_MAKE_PARALLEL_BUILDING), no)
# Standard building
internal-library-all_:: $(GNUSTEP_OBJ_DIR) \
internal-library-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) \
$(OBJ_DIRS_TO_CREATE) \
$(GNUSTEP_OBJ_DIR)/$(VERSION_LIBRARY_FILE)
else
# Parallel building. The actual compilation is delegated to a
# sub-make invocation where _GNUSTEP_MAKE_PARALLEL is set to yet.
# That sub-make invocation will compile files in parallel.
internal-library-all_:: $(GNUSTEP_OBJ_DIR) $(OBJ_DIRS_TO_CREATE)
internal-library-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) $(OBJ_DIRS_TO_CREATE)
$(ECHO_NOTHING)$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory --no-keep-going \
internal-library-compile \
GNUSTEP_TYPE=$(GNUSTEP_TYPE) \

View file

@ -53,14 +53,14 @@ ALL_OBJC_LIBS = \
ifeq ($(GNUSTEP_MAKE_PARALLEL_BUILDING), no)
# Standard building
internal-objc_program-all_:: \
$(GNUSTEP_OBJ_DIR) \
$(GNUSTEP_OBJ_INSTANCE_DIR) \
$(OBJ_DIRS_TO_CREATE) \
$(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)
else
# Parallel building. The actual compilation is delegated to a
# sub-make invocation where _GNUSTEP_MAKE_PARALLEL is set to yet.
# That sub-make invocation will compile files in parallel.
internal-objc_program-all_:: $(GNUSTEP_OBJ_DIR) $(OBJ_DIRS_TO_CREATE)
internal-objc_program-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) $(OBJ_DIRS_TO_CREATE)
$(ECHO_NOTHING)$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory --no-keep-going \
internal-objc_program-compile \
GNUSTEP_TYPE=$(GNUSTEP_TYPE) \

View file

@ -89,7 +89,7 @@ GNUSTEP_SHARED_BUNDLE_INSTALL_LOCAL_PATH = .
GNUSTEP_SHARED_BUNDLE_INSTALL_PATH = $(PALETTE_INSTALL_DIR)
include $(GNUSTEP_MAKEFILES)/Instance/Shared/bundle.make
internal-palette-all_:: $(GNUSTEP_OBJ_DIR) \
internal-palette-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) \
$(OBJ_DIRS_TO_CREATE) \
$(PALETTE_DIR)/Resources \
$(PALETTE_DIR)/$(GNUSTEP_TARGET_LDIR) \

View file

@ -160,7 +160,6 @@ endif
# most of the times we don't perform an Instance invocation at all on
# make clean or make distclean.
#
# The list of Objective-C source files to be compiled
# are in the OBJC_FILES variable.
@ -191,8 +190,10 @@ endif
# Please note the subtle difference:
#
# At `user' level (ie, in the user's GNUmakefile),
# the SUBPROJECTS variable is reserved for use with aggregate.make;
# the xxx_SUBPROJECTS variable is reserved for use with subproject.make.
# the SUBPROJECTS variable is reserved for use with aggregate.make
# (this will be renamed to AGGREGATE_PROJECTS in a future version of
# gnustep-make); the xxx_SUBPROJECTS variable is reserved for use with
# subproject.make.
#
# This separation *must* be enforced strictly, because nothing prevents
# a GNUmakefile from including both aggregate.make and subproject.make!
@ -204,10 +205,10 @@ SUBPROJECT_OBJ_FILES = $(foreach d, $($(GNUSTEP_INSTANCE)_SUBPROJECTS), \
endif
OBJC_OBJS = $(patsubst %.m,%.m$(OEXT),$($(GNUSTEP_INSTANCE)_OBJC_FILES))
OBJC_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_DIR)/,$(OBJC_OBJS))
OBJC_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(OBJC_OBJS))
OBJCC_OBJS = $(patsubst %.mm,%.mm$(OEXT),$($(GNUSTEP_INSTANCE)_OBJCC_FILES))
OBJCC_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_DIR)/,$(OBJCC_OBJS))
OBJCC_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(OBJCC_OBJS))
JAVA_OBJS = $(patsubst %.java,%.class,$($(GNUSTEP_INSTANCE)_JAVA_FILES))
JAVA_OBJ_FILES = $(JAVA_OBJS)
@ -218,10 +219,10 @@ JAVA_JNI_OBJ_FILES = $(JAVA_JNI_OBJS)
PSWRAP_C_FILES = $(patsubst %.psw,%.c,$($(GNUSTEP_INSTANCE)_PSWRAP_FILES))
PSWRAP_H_FILES = $(patsubst %.psw,%.h,$($(GNUSTEP_INSTANCE)_PSWRAP_FILES))
PSWRAP_OBJS = $(patsubst %.psw,%.c$(OEXT),$($(GNUSTEP_INSTANCE)_PSWRAP_FILES))
PSWRAP_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_DIR)/,$(PSWRAP_OBJS))
PSWRAP_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(PSWRAP_OBJS))
C_OBJS = $(patsubst %.c,%.c$(OEXT),$($(GNUSTEP_INSTANCE)_C_FILES))
C_OBJ_FILES = $(PSWRAP_OBJ_FILES) $(addprefix $(GNUSTEP_OBJ_DIR)/,$(C_OBJS))
C_OBJ_FILES = $(PSWRAP_OBJ_FILES) $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(C_OBJS))
# C++ files might end in .C, .cc, .cpp, .cxx, .cp so we replace multiple times
CC_OBJS = $(patsubst %.cc,%.cc$(OEXT),\
@ -229,11 +230,11 @@ CC_OBJS = $(patsubst %.cc,%.cc$(OEXT),\
$(patsubst %.cp,%.cp$(OEXT),\
$(patsubst %.cpp,%.cpp$(OEXT),\
$(patsubst %.cxx,%.cxx$(OEXT),$($(GNUSTEP_INSTANCE)_CC_FILES))))))
CC_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_DIR)/,$(CC_OBJS))
CC_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(CC_OBJS))
ifeq ($(findstring mingw32, $(GNUSTEP_TARGET_OS)), mingw32)
WINDRES_OBJS = $(patsubst %.rc,%.rc$(OEXT),$($(GNUSTEP_INSTANCE)_WINDRES_FILES))
WINDRES_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_DIR)/,$(WINDRES_OBJS))
WINDRES_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(WINDRES_OBJS))
else
WINDRES_OBJ_FILES =
endif
@ -249,51 +250,46 @@ OBJ_FILES = $($(GNUSTEP_INSTANCE)_OBJ_FILES)
# object file, or not).
OBJ_FILES_TO_LINK = $(strip $(C_OBJ_FILES) $(OBJC_OBJ_FILES) $(CC_OBJ_FILES) $(OBJCC_OBJ_FILES) $(WINDRES_OBJ_FILES) $(SUBPROJECT_OBJ_FILES) $(OBJ_FILES))
# This is the subset of OBJ_FILES_TO_LINK that includes all the files
# that we compile ourselves. Since we compile them ourselves, we are
# responsible for creating the directories in which they are stored.
# We exclude SUBPROJECT_OBJ_FILES since we are not responsible for
# creating subproject's directories, and OBJ_FILES since again these
# are obj files already available / built using some other process
# over which we have no control, so we are not responsible for
# creating the directories for them.
OBJ_FILES_TO_LINK_THAT_WE_CREATE = $(strip $(C_OBJ_FILES) $(OBJC_OBJ_FILES) $(CC_OBJ_FILES) $(OBJCC_OBJ_FILES) $(WINDRES_OBJ_FILES))
# OBJ_DIRS_TO_CREATE is the set of all directories that contain
# OBJ_FILES_TO_LINK. For example, if you want to compile
# ./Source/File.m, you'd generate a obj/Source/File.o file, and we
# first need to create the directory obj/Source. Source/File.m would
# be in OBJC_FILES, obj/Source/File.o would be in OBJ_FILES_TO_LINK,
# and obj/Source would be in OBJ_DIRS_TO_CREATE.
# ./Source/File.m, you'd generate a obj/Tool/Source/File.o file, and
# we first need to create the directory obj/Tool/Source.
# Tool/Source/File.m would be in OBJC_FILES, obj/Tool/Source/File.o
# would be in OBJ_FILES_TO_LINK_WE_CREATE, and obj/Tool/Source would
# be in OBJ_DIRS_TO_CREATE.
#
# Explanation: $(dir ...) is used to extract the directory; $(sort
# ...) is used to remove duplicates; $(filter-out ...) is used to
# remove $(GNUSTEP_OBJ_DIR) which would always appear and is already
# covered by default.
OBJ_DIRS_TO_CREATE = $(filter-out $(GNUSTEP_OBJ_DIR)/,$(sort $(dir $(OBJ_FILES_TO_LINK))))
# remove $(GNUSTEP_OBJ_INSTANCE_DIR) which would always
# appear and is already covered by default.
OBJ_DIRS_TO_CREATE = $(filter-out $(GNUSTEP_OBJ_INSTANCE_DIR)/,$(sort $(dir $(OBJ_FILES_TO_LINK_THAT_WE_CREATE))))
ifeq ($(GNUSTEP_MAKE_PARALLEL_BUILDING), no)
# Note that when doing a parallel build, we build instances in
# parallel. To prevent race conditions in building the directories or
# compiling the files, each instance has its own build directory to
# store its own object files, completely separate from the other
# instances. The GNUSTEP_OBJ_DIR is built during the Master
# invocation (so no concurrency issues there); each instance then
# builds its own GNUSTEP_OBJ_DIR/GNUSTEP_INSTANCE/ subdirectory and
# puts its object file in there.
$(OBJ_DIRS_TO_CREATE):
$(ECHO_CREATING)cd $(GNUSTEP_BUILD_DIR); $(MKDIRS) $@$(END_ECHO)
else
# When doing a parallel build, we build instances in parallel. If two
# instances need to create the same directory, there could be a race
# condition and one of the two might fail. So we use '-' here to tell
# GNU make to ignore any such errors and keep going. If the error was
# a legitimate one (not a concurrency-related one) the build will fail
# later when the object file can't be put into the directory. PS:
# This all can be avoided if you avoid having source files for two
# instances in the same subdirectory.
#
# FIXME/TODO: The better solution would be to prefix the
# OBJ_DIRS_TO_CREATE with the instance name to avoid any clashes.
# Then each instance has its own completely separate ./obj/ToolName/
# directory for its object files and there can be no concurrency
# issues. Unfortunately, this requires changing the top-level rules,
# and would break the "API" as the location of object files would
# change. Any GNUmakefile using $(GNUSTEP_OBJ_DIR) might potentially
# be broken. So it's a major change and we leave it for 2.4.0. For
# now, the hack of ignoring concurrency errors in the unlikely case
# that two instances need the same OBJ_DIRS_TO_CREATE is enough.
#
# FIXME: Unfortunately, there is another, more serious problem, which
# is that some people share source files between different tools.
# This breaks when they are built in parallel (eg, two submakes trying
# to create ./obj/Component.o). So we do need to isolate them more
# clearly.
$(OBJ_DIRS_TO_CREATE):
-$(ECHO_CREATING)cd $(GNUSTEP_BUILD_DIR); $(MKDIRS) $@$(END_ECHO)
endif
# The rule to create the objects file directory for this specific
# instance.
$(GNUSTEP_OBJ_INSTANCE_DIR):
$(ECHO_NOTHING)cd $(GNUSTEP_BUILD_DIR); \
$(MKDIRS) ./$(GNUSTEP_OBJ_INSTANCE_DIR_NAME)/$(END_ECHO)
# If C++ or ObjC++ are involved, we use the C++ compiler instead of
# the C/ObjC one to link; this happens automatically when compiling
@ -341,16 +337,16 @@ ifeq ($(GCC_WITH_PRECOMPILED_HEADERS),yes)
#
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))
C_PRECOMPILED_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_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))
OBJC_PRECOMPILED_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_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))
CC_PRECOMPILED_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_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))
OBJCC_PRECOMPILED_OBJ_FILES = $(addprefix $(GNUSTEP_OBJ_INSTANCE_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),)
@ -366,16 +362,16 @@ ifneq ($(C_PRECOMPILED_OBJ_FILES)$(OBJC_PRECOMPILED_OBJ_FILES)$(CC_PRECOMPILED_O
# to the non-precompiled header, no matter where the non-precompiled
# header is).
ifneq ($(C_PRECOMPILED_OBJ_FILES),)
C_PRECOMPILED_HEADERS_INCLUDE_FLAGS += -I$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/C
C_PRECOMPILED_HEADERS_INCLUDE_FLAGS += -I$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/C
endif
ifneq ($(OBJC_PRECOMPILED_OBJ_FILES),)
OBJC_PRECOMPILED_HEADERS_INCLUDE_FLAGS += -I$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjC
OBJC_PRECOMPILED_HEADERS_INCLUDE_FLAGS += -I$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/ObjC
endif
ifneq ($(CC_PRECOMPILED_OBJ_FILES),)
CC_PRECOMPILED_HEADERS_INCLUDE_FLAGS += -I$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/CC
CC_PRECOMPILED_HEADERS_INCLUDE_FLAGS += -I$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/CC
endif
ifneq ($(OBJCC_PRECOMPILED_OBJ_FILES),)
OBJCC_PRECOMPILED_HEADERS_INCLUDE_FLAGS += -I$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjCC
OBJCC_PRECOMPILED_HEADERS_INCLUDE_FLAGS += -I$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/ObjCC
endif
else

View file

@ -75,7 +75,7 @@ GNUSTEP_SHARED_BUNDLE_INSTALL_LOCAL_PATH = .
GNUSTEP_SHARED_BUNDLE_INSTALL_PATH = $(SERVICE_INSTALL_DIR)
include $(GNUSTEP_MAKEFILES)/Instance/Shared/bundle.make
internal-service-all_:: $(GNUSTEP_OBJ_DIR) \
internal-service-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) \
$(OBJ_DIRS_TO_CREATE) \
$(SERVICE_DIR)/$(GNUSTEP_TARGET_LDIR) \
internal-service-run-compile-submake \

View file

@ -34,14 +34,14 @@ endif
#
ifeq ($(GNUSTEP_MAKE_PARALLEL_BUILDING), no)
# Standard building
internal-subproject-all_:: $(GNUSTEP_OBJ_DIR) \
internal-subproject-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) \
$(OBJ_DIRS_TO_CREATE) \
$(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT)
else
# Parallel building. The actual compilation is delegated to a
# sub-make invocation where _GNUSTEP_MAKE_PARALLEL is set to yet.
# That sub-make invocation will compile files in parallel.
internal-subproject-all_:: $(GNUSTEP_OBJ_DIR) $(OBJ_DIRS_TO_CREATE)
internal-subproject-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) $(OBJ_DIRS_TO_CREATE)
$(ECHO_NOTHING)$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory --no-keep-going \
internal-subproject-compile \
GNUSTEP_TYPE=$(GNUSTEP_TYPE) \

View file

@ -63,14 +63,14 @@ endif
#
ifeq ($(GNUSTEP_MAKE_PARALLEL_BUILDING), no)
# Standard building
internal-tool-all_:: $(GNUSTEP_OBJ_DIR) \
internal-tool-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) \
$(OBJ_DIRS_TO_CREATE) \
$(GNUSTEP_OBJ_DIR)/$(GNUSTEP_INSTANCE)$(EXEEXT)
else
# Parallel building. The actual compilation is delegated to a
# sub-make invocation where _GNUSTEP_MAKE_PARALLEL is set to yes.
# That sub-make invocation will compile files in parallel.
internal-tool-all_:: $(GNUSTEP_OBJ_DIR) $(OBJ_DIRS_TO_CREATE)
internal-tool-all_:: $(GNUSTEP_OBJ_INSTANCE_DIR) $(OBJ_DIRS_TO_CREATE)
$(ECHO_NOTHING)$(MAKE) -f $(MAKEFILE_NAME) --no-print-directory --no-keep-going \
internal-tool-compile \
GNUSTEP_TYPE=$(GNUSTEP_TYPE) \

View file

@ -734,6 +734,14 @@ endif
GNUSTEP_OBJ_DIR = $(GNUSTEP_BUILD_DIR)/$(GNUSTEP_OBJ_DIR_NAME)
ifneq ($(GNUSTEP_INSTANCE),)
GNUSTEP_OBJ_INSTANCE_DIR_NAME = $(GNUSTEP_OBJ_DIR_NAME)/$(GNUSTEP_INSTANCE).obj
GNUSTEP_OBJ_INSTANCE_DIR = $(GNUSTEP_BUILD_DIR)/$(GNUSTEP_OBJ_INSTANCE_DIR_NAME)
else
GNUSTEP_OBJ_INSTANCE_DIR_NAME = $(warn "Makefile bug ... GNUSTEP_OBJ_INSTANCE_DIR_NAME used in Master invocation!")
GNUSTEP_OBJ_INSTANCE_DIR = $(warn "Makefile bug ... GNUSTEP_OBJ_INSTANCE_DIR used in Master invocation!")
endif
#
# Common variables for subprojects
#

View file

@ -332,7 +332,6 @@ endif
ALL_CPLISTFLAGS += $(ADDITIONAL_CPLISTFLAGS) $(AUXILIARY_CPLISTFLAGS)
# If we are using Windows32 DLLs, we pass -DGNUSTEP_WITH_DLL to the
# compiler. This preprocessor define might be used by library header
# files to know they are included from external code needing to use
@ -411,6 +410,17 @@ endif
%:: SCCS/s.%
# C/ObjC/C++ files are always compiled as part of the instance
# invocation (eg, while building a tool or an app). We put the object
# files (eg, NSObject.o, ie the result of compiling a C/ObjC/C++ file)
# in separate directories, one for each GNUSTEP_INSTANCE. The
# directories are $(GNUSTEP_OBJ_INSTANCE_DIR) (which usually is, eg,
# ./obj/gdomap.obj/). This allows different GNUSTEP_INSTANCEs to be
# built in parallel with no particular conflict. Here we include the
# rules for building C/ObjC/C++ files; they are only included when
# GNUSTEP_INSTANCE is defined.
ifneq ($(GNUSTEP_INSTANCE),)
#
# In exceptional conditions, you might need to want to use different compiler
# flags for a file (for example, if a file doesn't compile with optimization
@ -444,83 +454,96 @@ endif
# as well, so the following rule is simply equivalent to
# $(CC) $< -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@
# and similarly all the rules below
$(GNUSTEP_OBJ_DIR)/%.c$(OEXT) : %.c
$(GNUSTEP_OBJ_INSTANCE_DIR)/%.c$(OEXT) : %.c
$(ECHO_COMPILING)$(CC) $< -c \
$(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
$(ALL_CFLAGS)) \
$($<_FILE_FLAGS) -o $@$(END_ECHO)
$(GNUSTEP_OBJ_DIR)/%.m$(OEXT) : %.m
$(GNUSTEP_OBJ_INSTANCE_DIR)/%.m$(OEXT) : %.m
$(ECHO_COMPILING)$(CC) $< -c \
$(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
$(ALL_OBJCFLAGS)) \
$($<_FILE_FLAGS) -o $@$(END_ECHO)
$(GNUSTEP_OBJ_DIR)/%.C$(OEXT) : %.C
$(GNUSTEP_OBJ_INSTANCE_DIR)/%.C$(OEXT) : %.C
$(ECHO_COMPILING)$(CXX) $< -c \
$(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
$(ALL_CFLAGS) \
$(ALL_CCFLAGS)) \
$($<_FILE_FLAGS) -o $@$(END_ECHO)
$(GNUSTEP_OBJ_DIR)/%.cc$(OEXT) : %.cc
$(GNUSTEP_OBJ_INSTANCE_DIR)/%.cc$(OEXT) : %.cc
$(ECHO_COMPILING)$(CXX) $< -c \
$(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
$(ALL_CFLAGS) \
$(ALL_CCFLAGS)) \
$($<_FILE_FLAGS) -o $@$(END_ECHO)
$(GNUSTEP_OBJ_DIR)/%.cpp$(OEXT) : %.cpp
$(GNUSTEP_OBJ_INSTANCE_DIR)/%.cpp$(OEXT) : %.cpp
$(ECHO_COMPILING)$(CXX) $< -c \
$(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
$(ALL_CFLAGS) \
$(ALL_CCFLAGS)) \
$($<_FILE_FLAGS) -o $@$(END_ECHO)
$(GNUSTEP_OBJ_DIR)/%.cxx$(OEXT) : %.cxx
$(GNUSTEP_OBJ_INSTANCE_DIR)/%.cxx$(OEXT) : %.cxx
$(ECHO_COMPILING)$(CXX) $< -c \
$(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
$(ALL_CFLAGS) \
$(ALL_CCFLAGS)) \
$($<_FILE_FLAGS) -o $@$(END_ECHO)
$(GNUSTEP_OBJ_DIR)/%.cp$(OEXT) : %.cp
$(GNUSTEP_OBJ_INSTANCE_DIR)/%.cp$(OEXT) : %.cp
$(ECHO_COMPILING)$(CXX) $< -c \
$(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
$(ALL_CFLAGS) \
$(ALL_CCFLAGS)) \
$($<_FILE_FLAGS) -o $@$(END_ECHO)
$(GNUSTEP_OBJ_DIR)/%.mm$(OEXT) : %.mm
$(GNUSTEP_OBJ_INSTANCE_DIR)/%.mm$(OEXT) : %.mm
$(ECHO_COMPILING)$(CXX) $< -c \
$(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
$(ALL_OBJCCFLAGS)) \
$($<_FILE_FLAGS) -o $@$(END_ECHO)
#
# Special mingw32 specific rules to compile Windows resource files (.rc files)
# into object files.
#
ifeq ($(findstring mingw32, $(GNUSTEP_TARGET_OS)), mingw32)
# Add the .rc suffix on Windows.
.SUFFIXES: .rc
# A rule to generate a .o file from the .rc file.
$(GNUSTEP_OBJ_INSTANCE_DIR)/%.rc$(OEXT): %.rc
$(ECHO_COMPILING)windres $< $@$(END_ECHO)
endif
ifeq ($(GCC_WITH_PRECOMPILED_HEADERS),yes)
# 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/
$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/C/%.h.gch : %.h $(GNUSTEP_OBJ_INSTANCE_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/
$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/ObjC/%.h.gch : %.h $(GNUSTEP_OBJ_INSTANCE_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/
$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/CC/%.h.gch : %.h $(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/CC/
$(ECHO_PRECOMPILING)$(CXX) -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/
$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/ObjCC/%h.gch : %.h $(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/ObjCC/
$(ECHO_COMPILING)$(CXX) -x objective-c++-header $< -c \
$(filter-out $($<_FILE_FILTER_OUT_FLAGS),$(ALL_CPPFLAGS) \
$(ALL_OBJCCFLAGS)) \
@ -529,24 +552,26 @@ $(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjCC/%h.gch : %.h $(GNUSTEP_OBJ_DIR)/Prec
# 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_INSTANCE_DIR)/PrecompiledHeaders/C/:
$(ECHO_NOTHING)cd $(GNUSTEP_BUILD_DIR); \
$(MKDIRS) ./$(GNUSTEP_OBJ_DIR_NAME)/PrecompiledHeaders/C/$(END_ECHO)
$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjC/:
$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/ObjC/:
$(ECHO_NOTHING)cd $(GNUSTEP_BUILD_DIR); \
$(MKDIRS) ./$(GNUSTEP_OBJ_DIR_NAME)/PrecompiledHeaders/ObjC/$(END_ECHO)
$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/CC/:
$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/CC/:
$(ECHO_NOTHING)cd $(GNUSTEP_BUILD_DIR); \
$(MKDIRS) ./$(GNUSTEP_OBJ_DIR_NAME)/PrecompiledHeaders/CC/$(END_ECHO)
$(GNUSTEP_OBJ_DIR)/PrecompiledHeaders/ObjCC/:
$(GNUSTEP_OBJ_INSTANCE_DIR)/PrecompiledHeaders/ObjCC/:
$(ECHO_NOTHING)cd $(GNUSTEP_BUILD_DIR); \
$(MKDIRS) ./$(GNUSTEP_OBJ_DIR_NAME)/PrecompiledHeaders/ObjCC/$(END_ECHO)
endif
endif # End of code included only when GNUSTEP_INSTANCE is not empty
# FIXME - using a different build dir with java
# This rule is complicated because it supports for compiling a single
@ -619,19 +644,6 @@ endif
$(YACC) $(YACC_FLAGS) $<
mv -f y.tab.c $@
#
# Special mingw32 specific rules to compile Windows resource files (.rc files)
# into object files.
#
ifeq ($(findstring mingw32, $(GNUSTEP_TARGET_OS)), mingw32)
# Add the .rc suffix on Windows.
.SUFFIXES: .rc
# A rule to generate a .o file from the .rc file.
$(GNUSTEP_OBJ_DIR)/%.rc$(OEXT): %.rc
$(ECHO_COMPILING)windres $< $@$(END_ECHO)
endif
# The following dummy rules are needed for performance - we need to
# prevent make from spending time trying to compute how/if to rebuild
# the system makefiles! the following rules tell him that these files
@ -678,13 +690,16 @@ $(GNUSTEP_HOME)/$(GNUSTEP_USER_CONFIG_FILE): ;
endif
endif
# The rule to create the GNUSTEP_BUILD_DIR if any.
# The rule to create the GNUSTEP_BUILD_DIR if any. (TODO: Move this
# into Master/rules.make with the following one.)
ifneq ($(GNUSTEP_BUILD_DIR),.)
$(GNUSTEP_BUILD_DIR):
$(ECHO_CREATING)$(MKDIRS) $(GNUSTEP_BUILD_DIR)$(END_ECHO)
endif
# The rule to create the objects file directory.
# The rule to create the objects file directory. This should be done
# in the Master invocation. TODO: Move this rule into
# Master/rules.make once no more makefiles in Instance/ depdend on it.
$(GNUSTEP_OBJ_DIR):
$(ECHO_NOTHING)cd $(GNUSTEP_BUILD_DIR); \
$(MKDIRS) ./$(GNUSTEP_OBJ_DIR_NAME)$(END_ECHO)