home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Makefiles / pb_makefiles / install.make < prev    next >
Text File  |  1997-03-17  |  5KB  |  179 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. ifeq "$(OS)" "HPUX"
  45. STRIPFLAGS = -r
  46. endif
  47. ALL_STRIPFLAGS = $(STRIPFLAGS) $(PROJTYPE_STRIPFLAGS) $(OTHER_STRIPFLAGS)
  48. INSTALLED_PRODUCTS = $(addprefix $(DSTROOT)$(INSTALLDIR)/, $(notdir $(PRODUCTS)))
  49. ifeq "" "$(INSTALL_AS_USER)"
  50. INSTALL_AS_USER = root
  51. endif
  52. ifeq "" "$(INSTALL_AS_GROUP)"
  53. ifeq "NEXTSTEP" "$(OS)"
  54. INSTALL_AS_GROUP = wheel
  55. else
  56. INSTALL_AS_GROUP = bin
  57. endif
  58. endif
  59. ifeq "" "$(INSTALL_PERMISSION)"
  60. INSTALL_PERMISSIONS = o+rX
  61. endif
  62.  
  63. #
  64. # First we do local installation, then we recursively do postinstallation
  65. #
  66.  
  67. ifneq "YES" "$(SUPPRESS_BUILD)"
  68. ifeq ($(OS)-$(REINSTALLING)-$(STRIP_ON_INSTALL), WINDOWS--YES)
  69. install: all
  70.           $(MAKE) reinstall-stripped REINSTALLING=YES
  71. else
  72. install: local-install postinstall finish-install
  73. endif
  74. postinstall: local-postinstall recursive-postinstall
  75. recursive-postinstall: local-postinstall
  76. recursive-postinstall: $(RECURSABLE_DIRS:%=postinstall@%)
  77. ifndef RECURSING
  78. postinstall local-postinstall recursive-postinstall: local-install
  79. $(RECURSABLE_DIRS:%=postinstall@%): local-install
  80. endif
  81. endif
  82.  
  83. #
  84. # Local installation
  85. #
  86.  
  87. local-install: announce-install $(BEFORE_INSTALL) $(ACTUAL_INSTALL)
  88. $(ACTUAL_INSTALL): announce-install $(BEFORE_INSTALL)
  89. $(BEFORE_INSTALL): announce-install
  90.  
  91. local-postinstall: announce-postinstall $(BEFORE_POSTINSTALL) $(ACTUAL_POSTINSTALL) $(AFTER_POSTINSTALL)
  92. $(AFTER_POSTINSTALL): announce-postinstall $(BEFORE_POSTINSTALL) $(ACTUAL_POSTINSTALL)
  93. $(ACTUAL_POSTINSTALL): announce-postinstall $(BEFORE_POSTINSTALL)
  94. $(BEFORE_POSTINSTALL): announce-postinstall
  95.  
  96. #
  97. # before we do anything we announce our intentions
  98. #
  99.  
  100. announce-install:
  101.     $(SILENT) $(ECHO) Installing product...
  102.  
  103. announce-postinstall:
  104. ifndef RECURSING
  105.     $(SILENT) $(ECHO) Performing post-installation processing...
  106. else
  107.     $(SILENT) $(ECHO) $(RECURSIVE_ELLIPSIS)in $(NAME)
  108. endif
  109.  
  110. #
  111. # Actual installation is a matter of copying the product
  112. # to the destination area
  113. #
  114.  
  115. ifneq "" "$(INSTALLED_PRODUCTS)"
  116. install-products: $(DSTROOT)$(INSTALLDIR)
  117.     -$(CHMOD) -R +w $(INSTALLED_PRODUCTS)
  118.     $(RM) -rf $(INSTALLED_PRODUCTS)
  119.     ($(CD) $(PRODUCT_DIR) && $(TAR) cf - $(notdir $(PRODUCTS))) | ($(CD) $(DSTROOT)$(INSTALLDIR) && $(TAR) xf -)
  120. else
  121. install-products:
  122. endif
  123.  
  124. #
  125. # after installing we must strip the binaries
  126. #
  127.  
  128. ifneq "$(STRIPPED_PRODUCTS)" ""
  129. ifdef STRIP
  130. strip-binaries:
  131. ifneq "$(STRIP_ON_INSTALL)" "NO"
  132.     $(STRIP) $(ALL_STRIPFLAGS) $(subst $(PRODUCT_DIR),$(DSTROOT)$(INSTALLDIR),$(STRIPPED_PRODUCTS))
  133. endif
  134. endif
  135. endif
  136.  
  137. #
  138. # To ensure that header files are correct, use the rules
  139. # from installhdrs.make
  140. #
  141.  
  142. install-headers: local-installhdrs
  143.  
  144. #
  145. # then we finish installing and chmod/chown things
  146. #
  147.  
  148. finish-install: change-permissions $(AFTER_INSTALL)
  149. $(AFTER_INSTALL): change-permissions
  150.  
  151. ifneq "" "$(INSTALLED_PRODUCTS)"
  152. change-permissions:
  153. ifdef CHMOD
  154.     -$(CHMOD) -R ugo-w $(INSTALLED_PRODUCTS)
  155.     -$(CHMOD) -R $(INSTALL_PERMISSIONS) $(INSTALLED_PRODUCTS)
  156. endif
  157. ifdef CHGRP
  158.     -$(CHGRP) -R $(INSTALL_AS_GROUP) $(INSTALLED_PRODUCTS)
  159. endif
  160. ifdef CHOWN
  161.     -$(CHOWN) -R $(INSTALL_AS_USER) $(INSTALLED_PRODUCTS)
  162. endif
  163. else
  164. change-permissions:
  165. endif
  166.  
  167. #
  168. # rule for creating directories
  169. #
  170.  
  171. $(DSTROOT)$(INSTALLDIR):
  172.     $(SILENT) $(MKDIRS) $@
  173.  
  174.  
  175. ifeq "$(OS)" "WINDOWS"
  176. include $(MAKEFILEDIR)/reinstall.make
  177. endif
  178.  
  179.