home *** CD-ROM | disk | FTP | other *** search
- #
- # installsrc.make
- #
- # Rules for installing public and private header files of a project. This
- # target is invoked automatically from the install target.
- #
- # PUBLIC TARGETS
- # installsrc: copies source code from the current directory to a
- # specified directory.
- #
- # IMPORTED VARIABLES
- # BEFORE_INSTALLSRC: targets to build before installing source for a subproject
- # AFTER_INSTALLSRC: targets to build after installing source for a subproject
- #
- # EXPORTED VARIABLES
- # SRCROOT: base directory in which to place the new source files
- # SRCPATH: relative path from SRCROOT to present subdirectory
- #
-
- .PHONY: installsrc local-installsrc recursive-installsrc
- .PHONY: install-source-files
-
- #
- # Variable definitions
- #
-
- ACTUAL_INSTALLSRC = install-source-files
-
- #
- # First we do local installation, then we recurse. Note that,
- # unlike other recursive builds, source installation is never
- # suppressed.
- #
-
- ifeq "$(SRCROOT)" "$(shell pwd)"
- installsrc:
- $(SILENT) $(ECHO) Error: must set SRCROOT before building installsrc
- exit 1
- else
- installsrc: local-installsrc recursive-installsrc
- recursive-installsrc: $(ALL_SUBPROJECTS:%=installsrc@%) local-installsrc
- $(ALL_SUBPROJECTS:%=installsrc@%): local-installsrc
- endif
-
- #
- # Local installation
- #
-
- local-installsrc: announce-installsrc $(BEFORE_INSTALLSRC) $(ACTUAL_INSTALLSRC) $(AFTER_INSTALLSRC)
- $(AFTER_INSTALLSRC): announce-installsrc $(BEFORE_INSTALLSRC) $(ACTUAL_INSTALLSRC)
- $(ACTUAL_INSTALLSRC): announce-installsrc $(BEFORE_INSTALLSRC)
- $(BEFORE_INSTALLSRC): announce-installsrc
-
- #
- # Before we do anything we must announce our intentions
- # We don't announce our intentions if we were hooked in from the
- # postinstall recursion, since the postinstall has already been announced
- #
-
- announce-installsrc:
- ifndef RECURSING
- $(SILENT) $(ECHO) Installing source files...
- else
- $(SILENT) $(ECHO) $(RECURSIVE_ELLIPSIS)in $(NAME)
- endif
-
- #
- # Copy source files
- #
-
- IMPLICIT_SOURCE_FILES += Makefile
-
- install-source-files: $(SRCFILES) $(IMPLICIT_SOURCE_FILES)
- $(RM) -rf $(SRCROOT)$(SRCPATH)
- $(MKDIRS) $(SRCROOT)$(SRCPATH)
- $(TAR) cf - $(SRCFILES) | ( cd $(SRCROOT)$(SRCPATH) && $(TAR) xf - )
- $(SILENT) for i in $(IMPLICIT_SOURCE_FILES) none ; do \
- if [ -r $$i -a ! -r $(SRCROOT)$(SRCPATH)/$$i ] ; then \
- supportfiles="$$supportfiles $$i" ; \
- fi ; \
- done ; \
- if [ -n "$$supportfiles" ] ; then \
- $(ECHO) "$(TAR) cf - $$supportfiles | ( cd $(SRCROOT)$(SRCPATH) && $(TAR) xf - )" ; \
- $(TAR) cf - $$supportfiles | ( cd $(SRCROOT)$(SRCPATH) && $(TAR) xf - ) ; \
- fi
-
-