home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OpenStep 4.2J (Developer)
/
os42jdev.iso
/
NextDeveloper
/
Makefiles
/
pb_makefiles
/
install.make
< prev
next >
Wrap
Text File
|
1997-03-17
|
5KB
|
179 lines
#
# 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
ifeq "$(OS)" "HPUX"
STRIPFLAGS = -r
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)-$(STRIP_ON_INSTALL), WINDOWS--YES)
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
#
ifneq "" "$(INSTALLED_PRODUCTS)"
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 -)
else
install-products:
endif
#
# after installing we must strip the binaries
#
ifneq "$(STRIPPED_PRODUCTS)" ""
ifdef STRIP
strip-binaries:
ifneq "$(STRIP_ON_INSTALL)" "NO"
$(STRIP) $(ALL_STRIPFLAGS) $(subst $(PRODUCT_DIR),$(DSTROOT)$(INSTALLDIR),$(STRIPPED_PRODUCTS))
endif
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: change-permissions $(AFTER_INSTALL)
$(AFTER_INSTALL): change-permissions
ifneq "" "$(INSTALLED_PRODUCTS)"
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
else
change-permissions:
endif
#
# rule for creating directories
#
$(DSTROOT)$(INSTALLDIR):
$(SILENT) $(MKDIRS) $@
ifeq "$(OS)" "WINDOWS"
include $(MAKEFILEDIR)/reinstall.make
endif