home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Makefiles / pb_makefiles / installsrc.make < prev    next >
Text File  |  1996-12-05  |  3KB  |  87 lines

  1. #
  2. # installsrc.make
  3. #
  4. # Rules for installing public and private header files of a project.  This
  5. # target is invoked automatically from the install target.
  6. #
  7. # PUBLIC TARGETS
  8. #    installsrc: copies source code from the current directory to a
  9. #    specified directory.
  10. #
  11. # IMPORTED VARIABLES
  12. #    BEFORE_INSTALLSRC: targets to build before installing source for a subproject
  13. #    AFTER_INSTALLSRC: targets to build after installing source for a subproject
  14. #
  15. # EXPORTED VARIABLES
  16. #    SRCROOT:  base directory in which to place the new source files
  17. #    SRCPATH:  relative path from SRCROOT to present subdirectory
  18. #
  19.  
  20. .PHONY: installsrc local-installsrc recursive-installsrc
  21. .PHONY: install-source-files
  22.  
  23. #
  24. # Variable definitions
  25. #
  26.  
  27. ACTUAL_INSTALLSRC = install-source-files
  28.  
  29. #
  30. # First we do local installation, then we recurse.  Note that,
  31. # unlike other recursive builds, source installation is never
  32. # suppressed.
  33. #
  34.  
  35. ifeq "$(SRCROOT)" "$(shell pwd)"
  36. installsrc:
  37.     $(SILENT) $(ECHO) Error:  must set SRCROOT before building installsrc
  38.     exit 1
  39. else
  40. installsrc: local-installsrc recursive-installsrc
  41. recursive-installsrc: $(ALL_SUBPROJECTS:%=installsrc@%) local-installsrc
  42. $(ALL_SUBPROJECTS:%=installsrc@%): local-installsrc
  43. endif
  44.  
  45. #
  46. # Local installation
  47. #
  48.  
  49. local-installsrc: announce-installsrc $(BEFORE_INSTALLSRC) $(ACTUAL_INSTALLSRC) $(AFTER_INSTALLSRC)
  50. $(AFTER_INSTALLSRC): announce-installsrc $(BEFORE_INSTALLSRC) $(ACTUAL_INSTALLSRC)
  51. $(ACTUAL_INSTALLSRC): announce-installsrc $(BEFORE_INSTALLSRC)
  52. $(BEFORE_INSTALLSRC): announce-installsrc
  53.  
  54. #
  55. # Before we do anything we must announce our intentions
  56. # We don't announce our intentions if we were hooked in from the
  57. # postinstall recursion, since the postinstall has already been announced
  58. #
  59.  
  60. announce-installsrc:
  61. ifndef RECURSING
  62.     $(SILENT) $(ECHO) Installing source files...
  63. else
  64.     $(SILENT) $(ECHO) $(RECURSIVE_ELLIPSIS)in $(NAME)
  65. endif
  66.  
  67. #
  68. # Copy source files
  69. #
  70.  
  71. IMPLICIT_SOURCE_FILES += Makefile
  72.  
  73. install-source-files: $(SRCFILES) $(IMPLICIT_SOURCE_FILES)
  74.     $(RM) -rf $(SRCROOT)$(SRCPATH)
  75.     $(MKDIRS) $(SRCROOT)$(SRCPATH)
  76.     $(TAR) cf - $(SRCFILES) | ( cd $(SRCROOT)$(SRCPATH) && $(TAR) xf - )
  77.     $(SILENT) for i in $(IMPLICIT_SOURCE_FILES) none ; do \
  78.             if [ -r $$i -a ! -r $(SRCROOT)$(SRCPATH)/$$i ] ; then \
  79.                 supportfiles="$$supportfiles $$i" ; \
  80.             fi ; \
  81.         done ; \
  82.         if [ -n "$$supportfiles" ] ; then \
  83.        $(ECHO) "$(TAR) cf - $$supportfiles | ( cd $(SRCROOT)$(SRCPATH) && $(TAR) xf - )"  ; \
  84.        $(TAR) cf - $$supportfiles | ( cd $(SRCROOT)$(SRCPATH) && $(TAR) xf - ) ; \
  85.         fi
  86.  
  87.