home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Makefiles / pb_makefiles / build.make < prev    next >
Text File  |  1997-01-02  |  4KB  |  152 lines

  1. #
  2. # build.make
  3. #
  4. # Rules for building the product.
  5. #
  6. # PUBLIC TARGETS
  7. #    build: copies public and private header files to their
  8. #        final destination
  9. #
  10. # IMPORTED VARIABLES
  11. #    BEFORE_BUILD_RECURSION: targets to make before building subprojects
  12. #    BEFORE_BUILD: targets to make before a build, but after subprojects
  13. #    AFTER_BUILD: targets to make after a build
  14. #
  15. # EXPORTED VARIABLES
  16. #
  17.  
  18. .PHONY: build announce-build local-build recursive-build
  19. .PHONY: copy-local-resources copy-global-resources build-products
  20.  
  21. #
  22. # Variable definitions
  23. #
  24.  
  25. BEFORE_BUILD_RECURSION += $(GENERATED_SRCFILES)
  26. ifneq "$(DISABLE_PRECOMPS)" "YES"
  27. BEFORE_BUILD += $(PRECOMPILED_HEADERS:.h=.p) $(subst %.h, $(PUBLIC_HDR_DIR)$(PUBLIC_HEADER_DIR_SUFFIX)/%.p, $(PRECOMPILED_PUBLIC_HEADERS))
  28. endif
  29. ACTUAL_BUILD = build-directories build-java-classes copy-local-resources copy-global-resources build-products
  30.  
  31. #
  32. # First we recurse, then we do local build
  33. #
  34.  
  35. ifneq "YES" "$(SUPPRESS_BUILD)"
  36. build: announce-build before-build-recursion recursive-build local-build
  37. recursive-build: $(ALL_SUBPROJECTS:%=build@%) announce-build before-build-recursion
  38. local-build: recursive-build $(ALL_SUBPROJECTS:%=build@%) announce-build before-build-recursion
  39. $(ALL_SUBPROJECTS:%=build@%): announce-build before-build-recursion
  40. before-build-recursion: announce-build $(BEFORE_BUILD_RECURSION)
  41. endif
  42.  
  43. #
  44. # Local build
  45. #
  46.  
  47. local-build:  $(BEFORE_BUILD) $(ACTUAL_BUILD) $(AFTER_BUILD)
  48. $(AFTER_BUILD): $(BEFORE_BUILD) $(ACTUAL_BUILD)
  49. $(ACTUAL_BUILD): $(BEFORE_BUILD)
  50.  
  51. #
  52. # before we do anything we announce our intentions
  53. #
  54.  
  55. announce-build:
  56. ifndef RECURSING
  57.     $(SILENT) $(ECHO) Building...
  58. else
  59.     $(SILENT) $(ECHO) $(RECURSIVE_ELLIPSIS)in $(NAME)
  60. endif
  61.  
  62. #
  63. # Ensure that important directories exist
  64. #
  65.  
  66. build-directories: $(OFILE_DIR) $(SFILE_DIR) $(PRODUCT_DIR)
  67.  
  68. #
  69. # Compile java code
  70. #
  71.  
  72. build-java-classes: 
  73. ifeq "$(JAVA_ENABLED)" "YES"
  74.     $(JAVATOOL) $(OTHER_JAVATOOL_FLAGS) $(JAVAC_ARG) -newer -build -java_src $(JAVA_SRC_DIR) -java_obj $(JAVA_OBJ_DIR) $(JAVA_CLASSES)
  75. endif
  76.  
  77. #
  78. # Copying local resources
  79. #
  80.  
  81. ifneq "$(DISABLE_RESOURCE_COPYING)" "YES"
  82.  
  83. ifneq "" "$(LOCAL_RESOURCES)"
  84. copy-local-resources: $(LOCAL_RESOURCE_DIR) $(LOCAL_RESOURCES)
  85. ifneq "" "$(LOCAL_RESOURCE_DIR)"
  86.     $(SILENT) $(FASTCP) $(LOCAL_RESOURCES) $(LOCAL_RESOURCE_DIR)
  87. else
  88.     $(SILENT) $(ECHO) Error:  only wrapper-style projects can have resources
  89.     $(SILENT) exit 2
  90. endif
  91. endif
  92.  
  93. #
  94. # Copying global resources
  95. #
  96.  
  97. ifneq "$(GLOBAL_RESOURCES) $(OTHER_RESOURCES)" " "
  98. copy-global-resources: $(GLOBAL_RESOURCE_DIR) $(GLOBAL_RESOURCES) $(OTHER_RESOURCES)
  99. ifneq "$(GLOBAL_RESOURCE_DIR)" ""
  100.     $(SILENT) $(FASTCP) $(GLOBAL_RESOURCES) $(OTHER_RESOURCES) $(GLOBAL_RESOURCE_DIR)
  101. else
  102.     $(SILENT) $(ECHO) Error: Only wrapper-style projects can have resources
  103.     $(SILENT) exit 2
  104. endif
  105. endif
  106. endif
  107.  
  108. #
  109. # Building products
  110. #
  111.  
  112. ifeq "YES" "$(BUILD_OFILES_LIST_ONLY)"
  113. build-products: $(DEPENDENCIES)
  114. else
  115. build-products: $(PRODUCTS)
  116. endif
  117.  
  118. #
  119. # DEF-file generation (used on Windows only)
  120. #
  121.  
  122. ifeq "WINDOWS" "$(OS)"
  123. TMPFILE = $(OFILE_DIR)/nmtmpfile
  124. GENERATED_DEF_FILE = $(SFILE_DIR)/$(WINDOWS_DEF_FILE)
  125.  
  126. ifneq "$(ENABLE_DEF_FILE_GENERATION)" "NO"
  127. $(WINDOWS_DEF_FILE): $(OFILELISTS) $(OFILES)
  128.     $(SILENT) if [ ! -r "./$(WINDOWS_DEF_FILE)" ] ; then \
  129.         $(ECHO) -n "Generating $(notdir $@)...." ; \
  130.         (cd $(OFILE_DIR); $(DUMP_SYMBOLS) $(OFILES) $(addprefix @,$(OFILELISTS)) | $(EGREP) "(SECT).*(External).*(\|)" | $(EGREP) -v "(__GLOBAL_$I)|(_OBJC_)" | $(SED) "s/ _/ /" > $(TMPFILE)) ; \
  131.         $(ECHO) "LIBRARY $(NAME).dll" > $(GENERATED_DEF_FILE) ; \
  132.         $(ECHO) "EXPORTS" >> $(GENERATED_DEF_FILE) ; \
  133.         $(AWK) '$$3 == "SECT2" || $$NF ~ /^.objc_c/ {printf "\t%s CONSTANT\n", $$NF; next} $$3 == "SECT1" {printf "\t%s\n", $$NF}' $(TMPFILE) >> $(GENERATED_DEF_FILE) ; \
  134.         $(ECHO) "done"; \
  135.     fi
  136. endif
  137.  
  138. .PHONY: clean_deffile
  139.  
  140. clean_deffile:
  141.     $(RM) -f $(GENERATED_DEF_FILE)
  142. endif
  143.  
  144.  
  145. #
  146. # Rules for creating directories
  147. #
  148.  
  149. $(OFILE_DIR) $(SFILE_DIR) $(PRODUCT_DIR) $(LOCAL_RESOURCE_DIR) $(GLOBAL_RESOURCE_DIR):
  150.     $(SILENT) $(MKDIRS) $@
  151.  
  152.