home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Makefiles / pb_makefiles / subproj.make < prev    next >
Text File  |  1996-12-05  |  3KB  |  87 lines

  1. #
  2. # subproj.make
  3. #
  4. # Variable definitions and rules for building component subprojects.  A
  5. # component subproject contains code and resources which are needed by the
  6. # parent project, but which have been split off to simplify project management.
  7. #
  8. # PUBLIC TARGETS
  9. #    subproj: synonymous with all
  10. #
  11. # IMPORTED VARIABLES
  12. #    none
  13. #
  14. # EXPORTED VARIABLES
  15. #    none
  16. #
  17.  
  18. .PHONY: subproj all
  19. subproj: all
  20.  
  21. # Unlike most project types, the subproject can have two different
  22. # products.  On platforms which support the merging of .o files,
  23. # we will generate a .o file which contains the previous .o files.
  24. # On platforms where this is not supported we will generate an
  25. # ofilelist.  We must specify PRODUCT before we include common.make,
  26. # but will not know which product we are building until after we
  27. # have included common.make.  The solution to the dilemma is to
  28. # define PRODUCT to be a phony target which will build the actual
  29. # product
  30.  
  31. .PHONY: subproject_product
  32. PRODUCTS = subproject_product
  33.  
  34. include $(MAKEFILEDIR)/common.make
  35. -include $(LOCAL_MAKEFILEDIR)/subproj.make.preamble
  36.  
  37. O_PRODUCT = $(OFILE_DIR)/../$(SUBDIRECTORY_NAME)_subproj.o
  38. OFILELIST_PRODUCT = $(OFILE_DIR)/../$(SUBDIRECTORY_NAME)_subproj.ofileList
  39. ifeq "YES" "$(LINK_SUBPROJECTS)"
  40. ACTUAL_PRODUCT = $(O_PRODUCT)
  41. else
  42. ACTUAL_PRODUCT = $(OFILELIST_PRODUCT)
  43. endif
  44.  
  45. subproject_product: $(ACTUAL_PRODUCT)
  46.  
  47. # unlike other project types, a subproject must
  48. # generate its result even if the build is
  49. # suppressed or if there are no source files
  50.  
  51. # also unlike other project types, a subproject
  52. # is not built from all $(LOADABLES), just from
  53. # $(OFILES) and $(OFILELISTS)
  54.  
  55. ifeq "YES" "$(SUPPRESS_BUILD)"
  56. ARTIFICIAL_SUBPROJECT = YES
  57. OFILELISTS = 
  58. endif
  59. ifeq "" "$(filter %.o, $(OFILES))"
  60. ARTIFICIAL_SUBPROJECT = YES
  61. endif
  62.  
  63. ifeq "YES" "$(ARTIFICIAL_SUBPROJECT)"
  64.  
  65. build: $(ACTUAL_PRODUCT)
  66.  
  67. $(O_PRODUCT): $(OFILE_DIR) $(SFILE_DIR)/subproj_scratch_file.c
  68.     $(CC) -c $(SFILE_DIR)/subproj_scratch_file.c -o $(O_PRODUCT)
  69.  
  70. $(SFILE_DIR)/subproj_scratch_file.c: $(SFILE_DIR)
  71.     $(ECHO) static int x';' > $*.c
  72.  
  73. $(OFILELIST_PRODUCT): $(OFILE_DIR) $(SFILE_DIR)/subproj_scratch_file.c $(OFILELISTS)
  74.     $(CC) -c $(SFILE_DIR)/subproj_scratch_file.c -o $(OFILE_DIR)/subproj_scratch_file.o
  75.     $(OFILE_LIST_TOOL) $(OFILE_DIR)/subproj_scratch_file.o $(OFILELISTS) -o $(OFILELIST_PRODUCT)
  76.  
  77. else
  78.  
  79. $(O_PRODUCT): $(DEPENDENCIES) Makefile
  80.     $(CC) $(ALL_CFLAGS) -nostdlib $(OFILES) $(OFILELISTS) -r -o $(O_PRODUCT)
  81. $(OFILELIST_PRODUCT): $(DEPENDENCIES) Makefile
  82.     $(OFILE_LIST_TOOL) $(OFILES) $(OFILELISTS) -o $(OFILELIST_PRODUCT)
  83.  
  84. endif
  85.  
  86. -include $(LOCAL_MAKEFILEDIR)/subproj.make.postamble
  87.