home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OpenStep 4.2J (Developer)
/
os42jdev.iso
/
NextDeveloper
/
Makefiles
/
pb_makefiles
/
subproj.make
< prev
next >
Wrap
Text File
|
1996-12-05
|
3KB
|
87 lines
#
# subproj.make
#
# Variable definitions and rules for building component subprojects. A
# component subproject contains code and resources which are needed by the
# parent project, but which have been split off to simplify project management.
#
# PUBLIC TARGETS
# subproj: synonymous with all
#
# IMPORTED VARIABLES
# none
#
# EXPORTED VARIABLES
# none
#
.PHONY: subproj all
subproj: all
# Unlike most project types, the subproject can have two different
# products. On platforms which support the merging of .o files,
# we will generate a .o file which contains the previous .o files.
# On platforms where this is not supported we will generate an
# ofilelist. We must specify PRODUCT before we include common.make,
# but will not know which product we are building until after we
# have included common.make. The solution to the dilemma is to
# define PRODUCT to be a phony target which will build the actual
# product
.PHONY: subproject_product
PRODUCTS = subproject_product
include $(MAKEFILEDIR)/common.make
-include $(LOCAL_MAKEFILEDIR)/subproj.make.preamble
O_PRODUCT = $(OFILE_DIR)/../$(SUBDIRECTORY_NAME)_subproj.o
OFILELIST_PRODUCT = $(OFILE_DIR)/../$(SUBDIRECTORY_NAME)_subproj.ofileList
ifeq "YES" "$(LINK_SUBPROJECTS)"
ACTUAL_PRODUCT = $(O_PRODUCT)
else
ACTUAL_PRODUCT = $(OFILELIST_PRODUCT)
endif
subproject_product: $(ACTUAL_PRODUCT)
# unlike other project types, a subproject must
# generate its result even if the build is
# suppressed or if there are no source files
# also unlike other project types, a subproject
# is not built from all $(LOADABLES), just from
# $(OFILES) and $(OFILELISTS)
ifeq "YES" "$(SUPPRESS_BUILD)"
ARTIFICIAL_SUBPROJECT = YES
OFILELISTS =
endif
ifeq "" "$(filter %.o, $(OFILES))"
ARTIFICIAL_SUBPROJECT = YES
endif
ifeq "YES" "$(ARTIFICIAL_SUBPROJECT)"
build: $(ACTUAL_PRODUCT)
$(O_PRODUCT): $(OFILE_DIR) $(SFILE_DIR)/subproj_scratch_file.c
$(CC) -c $(SFILE_DIR)/subproj_scratch_file.c -o $(O_PRODUCT)
$(SFILE_DIR)/subproj_scratch_file.c: $(SFILE_DIR)
$(ECHO) static int x';' > $*.c
$(OFILELIST_PRODUCT): $(OFILE_DIR) $(SFILE_DIR)/subproj_scratch_file.c $(OFILELISTS)
$(CC) -c $(SFILE_DIR)/subproj_scratch_file.c -o $(OFILE_DIR)/subproj_scratch_file.o
$(OFILE_LIST_TOOL) $(OFILE_DIR)/subproj_scratch_file.o $(OFILELISTS) -o $(OFILELIST_PRODUCT)
else
$(O_PRODUCT): $(DEPENDENCIES) Makefile
$(CC) $(ALL_CFLAGS) -nostdlib $(OFILES) $(OFILELISTS) -r -o $(O_PRODUCT)
$(OFILELIST_PRODUCT): $(DEPENDENCIES) Makefile
$(OFILE_LIST_TOOL) $(OFILES) $(OFILELISTS) -o $(OFILELIST_PRODUCT)
endif
-include $(LOCAL_MAKEFILEDIR)/subproj.make.postamble