home *** CD-ROM | disk | FTP | other *** search
- #
- # install.make
- #
- # Rules for installing the product in its final destination. Installation
- # takes place in three stages. The first stage is to install the
- # products from the current project. The next stage is to recursively perform
- # post-install processing on every subproject. Finally, the destination is
- # chowned and chrooted.
- #
- # PUBLIC TARGETS
- # install: installs the product and any public or private header
- # files into their final destination.
- #
- # IMPORTED VARIABLES
- # PRODUCTS: products to install. All of these products will be placed in
- # the directory $(DSTROOT)$(INSTALLDIR)
- # INSTALL_AS_USER: owner of the intalled products (default root)
- # INSTALL_AS_GROUP: group of the installed products (default wheel)
- # INSTALL_PERMISSION: permissions of the installed product (default o+rX)
- # BEFORE_INSTALL: targets to build before installing the product
- # AFTER_INSTALL: targets to build after installing the product
- # BEFORE_POSTINSTALL: targets to build before postinstalling every subproject
- # AFTER_POSTINSTALL: targts to build after postinstalling every subproject
- # INSTALLDIR: final destination for installed products
- #
-
- .PHONY: install install-products install-hook
- .PHONY: postinstall recursive-postinstall local-postinstall
-
- #
- # Variable definitions
- #
-
- ifneq "YES" "$(BUILD_OFILES_LIST_ONLY)"
- ACTUAL_INSTALL = install-products
- ACTUAL_POSTINSTALL = strip-binaries install-headers
- else
- ACTUAL_INSTALL =
- ACTUAL_POSTINSTALL = install-headers
- endif
- ifeq "$(OS)" "NEXTSTEP"
- STRIPFLAGS = -S
- endif
- ALL_STRIPFLAGS = $(STRIPFLAGS) $(PROJTYPE_STRIPFLAGS) $(OTHER_STRIPFLAGS)
- INSTALLED_PRODUCTS = $(addprefix $(DSTROOT)$(INSTALLDIR)/, $(notdir $(PRODUCTS)))
- ifeq "" "$(INSTALL_AS_USER)"
- INSTALL_AS_USER = root
- endif
- ifeq "" "$(INSTALL_AS_GROUP)"
- ifeq "NEXTSTEP" "$(OS)"
- INSTALL_AS_GROUP = wheel
- else
- INSTALL_AS_GROUP = bin
- endif
- endif
- ifeq "" "$(INSTALL_PERMISSION)"
- INSTALL_PERMISSIONS = o+rX
- endif
-
- #
- # First we do local installation, then we recursively do postinstallation
- #
-
- ifneq "YES" "$(SUPPRESS_BUILD)"
- ifeq ($(OS)-$(REINSTALLING), WINDOWS-)
- install: all
- $(MAKE) reinstall-stripped REINSTALLING=YES
- else
- install: local-install postinstall finish-install
- endif
- postinstall: local-postinstall recursive-postinstall
- recursive-postinstall: local-postinstall
- recursive-postinstall: $(RECURSABLE_DIRS:%=postinstall@%)
- ifndef RECURSING
- postinstall local-postinstall recursive-postinstall: local-install
- $(RECURSABLE_DIRS:%=postinstall@%): local-install
- endif
- endif
-
- #
- # Local installation
- #
-
- local-install: announce-install $(BEFORE_INSTALL) $(ACTUAL_INSTALL)
- $(ACTUAL_INSTALL): announce-install $(BEFORE_INSTALL)
- $(BEFORE_INSTALL): announce-install
-
- local-postinstall: announce-postinstall $(BEFORE_POSTINSTALL) $(ACTUAL_POSTINSTALL) $(AFTER_POSTINSTALL)
- $(AFTER_POSTINSTALL): announce-postinstall $(BEFORE_POSTINSTALL) $(ACTUAL_POSTINSTALL)
- $(ACTUAL_POSTINSTALL): announce-postinstall $(BEFORE_POSTINSTALL)
- $(BEFORE_POSTINSTALL): announce-postinstall
-
- #
- # before we do anything we announce our intentions
- #
-
- announce-install:
- $(SILENT) $(ECHO) Installing product...
-
- announce-postinstall:
- ifndef RECURSING
- $(SILENT) $(ECHO) Performing post-installation processing...
- else
- $(SILENT) $(ECHO) $(RECURSIVE_ELLIPSIS)in $(NAME)
- endif
-
- #
- # Actual installation is a matter of copying the product
- # to the destination area
- #
-
- install-products: $(DSTROOT)$(INSTALLDIR)
- -$(CHMOD) -R +w $(INSTALLED_PRODUCTS)
- $(RM) -rf $(INSTALLED_PRODUCTS)
- ($(CD) $(PRODUCT_DIR) && $(TAR) cf - $(notdir $(PRODUCTS))) | ($(CD) $(DSTROOT)$(INSTALLDIR) && $(TAR) xf -)
-
- #
- # after installing we must strip the binaries
- #
-
- ifneq "" "$(STRIPPED_PRODUCTS)"
- ifdef STRIP
- strip-binaries:
- $(STRIP) $(ALL_STRIPFLAGS) $(subst $(PRODUCT_DIR),$(DSTROOT)$(INSTALLDIR),$(STRIPPED_PRODUCTS))
- endif
- endif
-
- #
- # To ensure that header files are correct, use the rules
- # from installhdrs.make
- #
-
- install-headers: local-installhdrs
-
- #
- # then we finish installing and chmod/chown things
- #
-
- finish-install: $(AFTER_INSTALL) change-permissions
- change-permission: $(AFTER_INSTALL)
-
- change-permissions:
- ifdef CHMOD
- -$(CHMOD) -R ugo-w $(INSTALLED_PRODUCTS)
- -$(CHMOD) -R $(INSTALL_PERMISSIONS) $(INSTALLED_PRODUCTS)
- endif
- ifdef CHGRP
- -$(CHGRP) -R $(INSTALL_AS_GROUP) $(INSTALLED_PRODUCTS)
- endif
- ifdef CHOWN
- -$(CHOWN) -R $(INSTALL_AS_USER) $(INSTALLED_PRODUCTS)
- endif
-
- #
- # rule for creating directories
- #
-
- $(DSTROOT)$(INSTALLDIR):
- $(SILENT) $(MKDIRS) $@
-
- #
- # Special rules for making stripped targets on NT
- # Note that this section is duplicated in aggregate.make, and any
- # changes made here must be reflected there.
- #
- ifeq "$(OS)" "WINDOWS"
- STRIPNAME = STRIPPED
- GARBAGE += $(OBJROOT)/$(STRIPNAME) $(SYMROOT)/$(STRIPNAME)
-
- ifeq "$(REINSTALLING)" "YES"
-
- STRIPO = $(NEXT_ROOT)/NextDeveloper/Libraries/gcc-lib/$(ARCH)/StabsToCodeview.exe
- STRIPDIRS = $(OBJROOT)/$(STRIPNAME) $(SYMROOT)/$(STRIPNAME)
-
- CLONE_AND_STRIP = $(FIND) . '(' -name $(STRIPNAME) -prune ')' \
- -o '(' -type d -exec $(MKDIRS) $(STRIPNAME)/'{}' ';' ')' \
- -o '(' -name '*.exe' -o -name '*.dll' -o -name '*.lib' -name 'lib*.a' ')' \
- -o '(' -name '*.EXE' -o -name '*.DLL' -o -name '*.LIB' -name 'LIB*.A' ')' \
- -o '(' -name '*.ofileList' -o -name '*.ofilelist' -o -name '*.lastbuildtime.*' ')' \
- -o '(' -name '*.o' -exec $(STRIPO) -g0 '{}' -o $(STRIPNAME)/'{}' ';' ')' \
- -o -exec $(CP) -p '{}' $(STRIPNAME)/'{}' ';'
-
- .PHONY: clone_and_strip reinstall-stripped
-
- clone_and_strip:
- $(MKDIRS) $(OBJROOT)/$(STRIPNAME) $(SYMROOT)/$(STRIPNAME)
- cd $(OBJROOT) && $(CLONE_AND_STRIP)
- cd $(SYMROOT) && $(CLONE_AND_STRIP)
-
- reinstall-stripped: clone_and_strip
- $(SILENT)if $(ECHO) $(OBJROOT) | $(GREP) -v $(STRIPNAME) $(BURY_STDERR) ; then \
- cmd='$(MAKE) install OBJROOT=$(OBJROOT)/$(STRIPNAME) SYMROOT=$(SYMROOT)/$(STRIPNAME) DEBUG_SYMBOLS_CFLAG= SKIP_EXPORTING_HEADERS=YES' ; \
- $(ECHO) $$cmd ; $$cmd ; \
- fi
-
- endif
- endif
-