home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OpenStep 4.2J (Developer)
/
os42jdev.iso
/
NextDeveloper
/
Makefiles
/
pb_makefiles
/
build.make
< prev
next >
Wrap
Text File
|
1997-01-02
|
4KB
|
152 lines
#
# build.make
#
# Rules for building the product.
#
# PUBLIC TARGETS
# build: copies public and private header files to their
# final destination
#
# IMPORTED VARIABLES
# BEFORE_BUILD_RECURSION: targets to make before building subprojects
# BEFORE_BUILD: targets to make before a build, but after subprojects
# AFTER_BUILD: targets to make after a build
#
# EXPORTED VARIABLES
#
.PHONY: build announce-build local-build recursive-build
.PHONY: copy-local-resources copy-global-resources build-products
#
# Variable definitions
#
BEFORE_BUILD_RECURSION += $(GENERATED_SRCFILES)
ifneq "$(DISABLE_PRECOMPS)" "YES"
BEFORE_BUILD += $(PRECOMPILED_HEADERS:.h=.p) $(subst %.h, $(PUBLIC_HDR_DIR)$(PUBLIC_HEADER_DIR_SUFFIX)/%.p, $(PRECOMPILED_PUBLIC_HEADERS))
endif
ACTUAL_BUILD = build-directories build-java-classes copy-local-resources copy-global-resources build-products
#
# First we recurse, then we do local build
#
ifneq "YES" "$(SUPPRESS_BUILD)"
build: announce-build before-build-recursion recursive-build local-build
recursive-build: $(ALL_SUBPROJECTS:%=build@%) announce-build before-build-recursion
local-build: recursive-build $(ALL_SUBPROJECTS:%=build@%) announce-build before-build-recursion
$(ALL_SUBPROJECTS:%=build@%): announce-build before-build-recursion
before-build-recursion: announce-build $(BEFORE_BUILD_RECURSION)
endif
#
# Local build
#
local-build: $(BEFORE_BUILD) $(ACTUAL_BUILD) $(AFTER_BUILD)
$(AFTER_BUILD): $(BEFORE_BUILD) $(ACTUAL_BUILD)
$(ACTUAL_BUILD): $(BEFORE_BUILD)
#
# before we do anything we announce our intentions
#
announce-build:
ifndef RECURSING
$(SILENT) $(ECHO) Building...
else
$(SILENT) $(ECHO) $(RECURSIVE_ELLIPSIS)in $(NAME)
endif
#
# Ensure that important directories exist
#
build-directories: $(OFILE_DIR) $(SFILE_DIR) $(PRODUCT_DIR)
#
# Compile java code
#
build-java-classes:
ifeq "$(JAVA_ENABLED)" "YES"
$(JAVATOOL) $(OTHER_JAVATOOL_FLAGS) $(JAVAC_ARG) -newer -build -java_src $(JAVA_SRC_DIR) -java_obj $(JAVA_OBJ_DIR) $(JAVA_CLASSES)
endif
#
# Copying local resources
#
ifneq "$(DISABLE_RESOURCE_COPYING)" "YES"
ifneq "" "$(LOCAL_RESOURCES)"
copy-local-resources: $(LOCAL_RESOURCE_DIR) $(LOCAL_RESOURCES)
ifneq "" "$(LOCAL_RESOURCE_DIR)"
$(SILENT) $(FASTCP) $(LOCAL_RESOURCES) $(LOCAL_RESOURCE_DIR)
else
$(SILENT) $(ECHO) Error: only wrapper-style projects can have resources
$(SILENT) exit 2
endif
endif
#
# Copying global resources
#
ifneq "$(GLOBAL_RESOURCES) $(OTHER_RESOURCES)" " "
copy-global-resources: $(GLOBAL_RESOURCE_DIR) $(GLOBAL_RESOURCES) $(OTHER_RESOURCES)
ifneq "$(GLOBAL_RESOURCE_DIR)" ""
$(SILENT) $(FASTCP) $(GLOBAL_RESOURCES) $(OTHER_RESOURCES) $(GLOBAL_RESOURCE_DIR)
else
$(SILENT) $(ECHO) Error: Only wrapper-style projects can have resources
$(SILENT) exit 2
endif
endif
endif
#
# Building products
#
ifeq "YES" "$(BUILD_OFILES_LIST_ONLY)"
build-products: $(DEPENDENCIES)
else
build-products: $(PRODUCTS)
endif
#
# DEF-file generation (used on Windows only)
#
ifeq "WINDOWS" "$(OS)"
TMPFILE = $(OFILE_DIR)/nmtmpfile
GENERATED_DEF_FILE = $(SFILE_DIR)/$(WINDOWS_DEF_FILE)
ifneq "$(ENABLE_DEF_FILE_GENERATION)" "NO"
$(WINDOWS_DEF_FILE): $(OFILELISTS) $(OFILES)
$(SILENT) if [ ! -r "./$(WINDOWS_DEF_FILE)" ] ; then \
$(ECHO) -n "Generating $(notdir $@)...." ; \
(cd $(OFILE_DIR); $(DUMP_SYMBOLS) $(OFILES) $(addprefix @,$(OFILELISTS)) | $(EGREP) "(SECT).*(External).*(\|)" | $(EGREP) -v "(__GLOBAL_$I)|(_OBJC_)" | $(SED) "s/ _/ /" > $(TMPFILE)) ; \
$(ECHO) "LIBRARY $(NAME).dll" > $(GENERATED_DEF_FILE) ; \
$(ECHO) "EXPORTS" >> $(GENERATED_DEF_FILE) ; \
$(AWK) '$$3 == "SECT2" || $$NF ~ /^.objc_c/ {printf "\t%s CONSTANT\n", $$NF; next} $$3 == "SECT1" {printf "\t%s\n", $$NF}' $(TMPFILE) >> $(GENERATED_DEF_FILE) ; \
$(ECHO) "done"; \
fi
endif
.PHONY: clean_deffile
clean_deffile:
$(RM) -f $(GENERATED_DEF_FILE)
endif
#
# Rules for creating directories
#
$(OFILE_DIR) $(SFILE_DIR) $(PRODUCT_DIR) $(LOCAL_RESOURCE_DIR) $(GLOBAL_RESOURCE_DIR):
$(SILENT) $(MKDIRS) $@