home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / install.make < prev    next >
Encoding:
Text File  |  1996-09-08  |  5.8 KB  |  198 lines

  1. #
  2. # install.make
  3. #
  4. # Rules for installing the product in its final destination.  Installation
  5. # takes place in three stages.  The first stage is to install the
  6. # products from the current project.  The next stage is to recursively perform
  7. # post-install processing on every subproject.  Finally, the destination is
  8. # chowned and chrooted.
  9. #
  10. # PUBLIC TARGETS
  11. #    install: installs the product and any public or private header
  12. #     files into their final destination.
  13. #
  14. # IMPORTED VARIABLES
  15. #    PRODUCTS: products to install.  All of these products will be placed in
  16. #     the directory $(DSTROOT)$(INSTALLDIR)
  17. #    INSTALL_AS_USER: owner of the intalled products (default root)
  18. #    INSTALL_AS_GROUP: group of the installed products (default wheel)
  19. #    INSTALL_PERMISSION: permissions of the installed product (default o+rX)
  20. #    BEFORE_INSTALL: targets to build before installing the product
  21. #    AFTER_INSTALL: targets to build after installing the product
  22. #    BEFORE_POSTINSTALL: targets to build before postinstalling every subproject
  23. #    AFTER_POSTINSTALL: targts to build after postinstalling every subproject
  24. #    INSTALLDIR: final destination for installed products
  25. #
  26.  
  27. .PHONY:  install install-products install-hook
  28. .PHONY:  postinstall recursive-postinstall local-postinstall
  29.  
  30. #
  31. # Variable definitions
  32. #
  33.  
  34. ifneq "YES" "$(BUILD_OFILES_LIST_ONLY)"
  35. ACTUAL_INSTALL = install-products
  36. ACTUAL_POSTINSTALL = strip-binaries install-headers
  37. else
  38. ACTUAL_INSTALL =
  39. ACTUAL_POSTINSTALL = install-headers
  40. endif
  41. ifeq "$(OS)" "NEXTSTEP"
  42. STRIPFLAGS = -S
  43. endif
  44. ALL_STRIPFLAGS = $(STRIPFLAGS) $(PROJTYPE_STRIPFLAGS) $(OTHER_STRIPFLAGS)
  45. INSTALLED_PRODUCTS = $(addprefix $(DSTROOT)$(INSTALLDIR)/, $(notdir $(PRODUCTS)))
  46. ifeq "" "$(INSTALL_AS_USER)"
  47. INSTALL_AS_USER = root
  48. endif
  49. ifeq "" "$(INSTALL_AS_GROUP)"
  50. ifeq "NEXTSTEP" "$(OS)"
  51. INSTALL_AS_GROUP = wheel
  52. else
  53. INSTALL_AS_GROUP = bin
  54. endif
  55. endif
  56. ifeq "" "$(INSTALL_PERMISSION)"
  57. INSTALL_PERMISSIONS = o+rX
  58. endif
  59.  
  60. #
  61. # First we do local installation, then we recursively do postinstallation
  62. #
  63.  
  64. ifneq "YES" "$(SUPPRESS_BUILD)"
  65. ifeq ($(OS)-$(REINSTALLING), WINDOWS-)
  66. install: all
  67.           $(MAKE) reinstall-stripped REINSTALLING=YES
  68. else
  69. install: local-install postinstall finish-install
  70. endif
  71. postinstall: local-postinstall recursive-postinstall
  72. recursive-postinstall: local-postinstall
  73. recursive-postinstall: $(RECURSABLE_DIRS:%=postinstall@%)
  74. ifndef RECURSING
  75. postinstall local-postinstall recursive-postinstall: local-install
  76. $(RECURSABLE_DIRS:%=postinstall@%): local-install
  77. endif
  78. endif
  79.  
  80. #
  81. # Local installation
  82. #
  83.  
  84. local-install: announce-install $(BEFORE_INSTALL) $(ACTUAL_INSTALL)
  85. $(ACTUAL_INSTALL): announce-install $(BEFORE_INSTALL)
  86. $(BEFORE_INSTALL): announce-install
  87.  
  88. local-postinstall: announce-postinstall $(BEFORE_POSTINSTALL) $(ACTUAL_POSTINSTALL) $(AFTER_POSTINSTALL)
  89. $(AFTER_POSTINSTALL): announce-postinstall $(BEFORE_POSTINSTALL) $(ACTUAL_POSTINSTALL)
  90. $(ACTUAL_POSTINSTALL): announce-postinstall $(BEFORE_POSTINSTALL)
  91. $(BEFORE_POSTINSTALL): announce-postinstall
  92.  
  93. #
  94. # before we do anything we announce our intentions
  95. #
  96.  
  97. announce-install:
  98.     $(SILENT) $(ECHO) Installing product...
  99.  
  100. announce-postinstall:
  101. ifndef RECURSING
  102.     $(SILENT) $(ECHO) Performing post-installation processing...
  103. else
  104.     $(SILENT) $(ECHO) $(RECURSIVE_ELLIPSIS)in $(NAME)
  105. endif
  106.  
  107. #
  108. # Actual installation is a matter of copying the product
  109. # to the destination area
  110. #
  111.  
  112. install-products: $(DSTROOT)$(INSTALLDIR)
  113.     -$(CHMOD) -R +w $(INSTALLED_PRODUCTS)
  114.     $(RM) -rf $(INSTALLED_PRODUCTS)
  115.     ($(CD) $(PRODUCT_DIR) && $(TAR) cf - $(notdir $(PRODUCTS))) | ($(CD) $(DSTROOT)$(INSTALLDIR) && $(TAR) xf -)
  116.  
  117. #
  118. # after installing we must strip the binaries
  119. #
  120.  
  121. ifneq "" "$(STRIPPED_PRODUCTS)"
  122. ifdef STRIP
  123. strip-binaries:
  124.     $(STRIP) $(ALL_STRIPFLAGS) $(subst $(PRODUCT_DIR),$(DSTROOT)$(INSTALLDIR),$(STRIPPED_PRODUCTS))
  125. endif
  126. endif
  127.  
  128. #
  129. # To ensure that header files are correct, use the rules
  130. # from installhdrs.make
  131. #
  132.  
  133. install-headers: local-installhdrs
  134.  
  135. #
  136. # then we finish installing and chmod/chown things
  137. #
  138.  
  139. finish-install: $(AFTER_INSTALL) change-permissions
  140. change-permission: $(AFTER_INSTALL)
  141.  
  142. change-permissions:
  143. ifdef CHMOD
  144.     -$(CHMOD) -R ugo-w $(INSTALLED_PRODUCTS)
  145.     -$(CHMOD) -R $(INSTALL_PERMISSIONS) $(INSTALLED_PRODUCTS)
  146. endif
  147. ifdef CHGRP
  148.     -$(CHGRP) -R $(INSTALL_AS_GROUP) $(INSTALLED_PRODUCTS)
  149. endif
  150. ifdef CHOWN
  151.     -$(CHOWN) -R $(INSTALL_AS_USER) $(INSTALLED_PRODUCTS)
  152. endif
  153.  
  154. #
  155. # rule for creating directories
  156. #
  157.  
  158. $(DSTROOT)$(INSTALLDIR):
  159.     $(SILENT) $(MKDIRS) $@
  160.  
  161. # Special rules for making stripped targets on NT
  162. # Note that this section is duplicated in aggregate.make, and any
  163. # changes made here must be reflected there.
  164. #
  165. ifeq "$(OS)" "WINDOWS"
  166. STRIPNAME = STRIPPED
  167. GARBAGE += $(OBJROOT)/$(STRIPNAME) $(SYMROOT)/$(STRIPNAME)
  168.  
  169. ifeq "$(REINSTALLING)" "YES"
  170.  
  171. STRIPO = $(NEXT_ROOT)/NextDeveloper/Libraries/gcc-lib/$(ARCH)/StabsToCodeview.exe
  172. STRIPDIRS = $(OBJROOT)/$(STRIPNAME) $(SYMROOT)/$(STRIPNAME)
  173.  
  174. CLONE_AND_STRIP = $(FIND) . '(' -name $(STRIPNAME) -prune ')' \
  175.   -o '(' -type d -exec $(MKDIRS) $(STRIPNAME)/'{}' ';' ')' \
  176.   -o '(' -name '*.exe' -o -name '*.dll' -o -name '*.lib' -name 'lib*.a' ')' \
  177.   -o '(' -name '*.EXE' -o -name '*.DLL' -o -name '*.LIB' -name 'LIB*.A' ')' \
  178.   -o '(' -name '*.ofileList' -o -name '*.ofilelist' -o -name '*.lastbuildtime.*' ')' \
  179.   -o '(' -name '*.o' -exec $(STRIPO) -g0 '{}' -o $(STRIPNAME)/'{}' ';' ')' \
  180.   -o -exec $(CP) -p '{}' $(STRIPNAME)/'{}' ';'
  181.  
  182. .PHONY: clone_and_strip reinstall-stripped
  183.  
  184. clone_and_strip:
  185.     $(MKDIRS) $(OBJROOT)/$(STRIPNAME) $(SYMROOT)/$(STRIPNAME)
  186.     cd $(OBJROOT) && $(CLONE_AND_STRIP)
  187.     cd $(SYMROOT) && $(CLONE_AND_STRIP)
  188.  
  189. reinstall-stripped: clone_and_strip 
  190.     $(SILENT)if $(ECHO) $(OBJROOT) | $(GREP) -v $(STRIPNAME) $(BURY_STDERR) ; then \
  191.        cmd='$(MAKE) install OBJROOT=$(OBJROOT)/$(STRIPNAME) SYMROOT=$(SYMROOT)/$(STRIPNAME) DEBUG_SYMBOLS_CFLAG= SKIP_EXPORTING_HEADERS=YES' ; \
  192.        $(ECHO) $$cmd ; $$cmd ; \
  193.     fi
  194.  
  195. endif
  196. endif
  197.