home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Makefiles / app / bundle.make < prev    next >
Text File  |  1992-07-07  |  6KB  |  145 lines

  1. #
  2. #                                 bundle.make
  3. #
  4. # Inputs from Makefile.preamble or Makefile.postamble (no defaults):
  5. #    OTHER_CFLAGS - Flags passed to compiler (in addition to -g, -O, etc.)
  6. #    OTHER_LDFLAGS - Flags passed to ld (in addition to -ObjC, etc.)
  7. #    OTHER_OFILES - Additional relocatables that may be linked in
  8. #    OTHER_PRODUCT_DEPENDS - Other dependencies of this project
  9. #    OTHER_SOURCEFILES - Other source files maintained by .pre/postamble
  10. #    OTHER_GARBAGE - Additional files to be removed by make 'clean' 
  11. #
  12. #    DSTROOT - Virtual root directory prepended to $(INSTALLDIR)
  13. #
  14. # Inputs from Makefile.preamble:
  15. #    PRECOMPS - Precompiled headers that should be built before compilation 
  16. #    OTHER_INITIAL_TARGETS - Targets to be built before subprojects, etc.
  17. #
  18. # Inputs from Makefile.postamble (with defaults set by this file)3MAKEFILES - Makefiles this project depends on (default = Makefile)
  19. #    DEFAULT_CFLAGS - Set of CFLAGS used in compiling (default set below)
  20. #
  21. # Inputs from Makefile (avoid setting these, ProjectBuilder controls them):
  22. #    NAME - name of application
  23. #    LANGUAGE - langage in which the project is written (default "English")
  24. #    LOCAL_RESOURCES - localized resources (e.g. nib's, images) of project
  25. #    GLOBAL_RESOURCES - non-localized resources of project
  26. #
  27. #    CLASSES - Class implementation files in project.
  28. #    HFILES - Header files in project.
  29. #    MFILES - Other Objective-C source files in project. 
  30. #    CFILES - Other C source files in project. 
  31. #    PSWFILES - .psw files in the project
  32. #    PSWMFILES - .pswm files in the project
  33. #    SUBPROJECTS - Subprojects of this project
  34. #    BUNDLES - Bundle subprojects of this project
  35. #    OTHERSRCS - Other miscellaneous sources of this project
  36. #    OTHERLINKED - Source files not matching a standard source extention
  37. #    OTHERLINKEDOFILES - Other relocatable files to (always) link in.
  38. #
  39. #    MAKEFILEDIR - Directory in which to find this generic set of Makefiles
  40. #    INSTALLDIR - Directory app will be installed into by 'install' target
  41. #
  42. # Outputs to common.make:
  43. #    OFILE_DIR
  44. #    DERIVED_FILES
  45. #    PRODUCT_ROOT (overloaded by command-line when this is not standalone)
  46. #
  47.  
  48. OFILE_DIR = obj
  49. DERIVED_FILES = $(NAME) $(OFILE_DIR)
  50. BUNDLE_DIR = $(NAME).bproj
  51. CFLAGS = -g -O -Wall
  52. DEFAULT_CFLAGS = $(CFLAGS) $(OTHER_CFLAGS)
  53.  
  54. PRODUCT_ROOT = $(BUNDLE_DIR:.bproj=.bundle)
  55. BUNDLE = $(NAME:.bproj=)
  56.  
  57. include $(MAKEFILEDIR)/common.make
  58.  
  59. # Rewrite various rules to simulate a 'debug' for the standalone case
  60.  
  61. .c.o:
  62.     $(CC) $(DEFAULT_CFLAGS) -c $*.c -o $(OFILE_DIR)/$*.o
  63. .m.o:
  64.     $(CC) $(DEFAULT_CFLAGS) $(OBJCFLAGS) -c $*.m -o $(OFILE_DIR)/$*.o
  65. .psw.o:
  66.     $(PSWRAP) $(PSWFLAGS) -a -h $*.h -o $*.c $*.psw
  67.     $(CC) $(DEFAULT_CFLAGS) -c $*.c -o $(OFILE_DIR)/$*.o
  68. .pswm.o:
  69.     $(PSWRAP) $(PSWFLAGS) -a -h $*.h -o $*.m $*.pswm
  70.     $(CC) $(DEFAULT_CFLAGS) $(OBJCFLAGS) -c $*.m -o $(OFILE_DIR)/$*.o
  71.  
  72.  
  73.  
  74. all:: project
  75.  
  76. project:: $(INITIAL_TARGETS) subcomponents resources $(PRODUCT_ROOT)/$(BUNDLE)
  77.             
  78. $(PRODUCT_ROOT):
  79.     @$(MKDIRS) $(PRODUCT_ROOT)
  80.  
  81. $(PRODUCT_ROOT)/$(BUNDLE): $(PRODUCT_DEPENDS) $(PRODUCT_ROOT)
  82.     @(if [ "`$(ECHO) $(OFILES) $(OTHER_OFILES) | wc -w`" != "       0" ] ; then \
  83.        $(ECHO) $(LD) -r $(BUNDLELDFLAGS) -o $(PRODUCT_ROOT)/$(BUNDLE) $(OFILES) $(OTHER_OFIL3; \
  84.        $(LD) -r $(BUNDLELDFLAGS) -o $(PRODUCT_ROOT)/$(BUNDLE) $(OFILES) $(OTHER_OFILES) ; \
  85.        $(CHMOD) a+x $(PRODUCT_ROOT)/$(BUNDLE) ; \
  86.     else \
  87.        $(ECHO) Warning: No object files to link for this bundle.  No relocatable produced. ; \
  88.     fi)
  89.  
  90. depend:: Makefile.dependencies $(SUBPROJECTS:.subproj=.depend) $(BUNDLES:.bproj=.depend)
  91.  
  92. $(DSTROOT)$(INSTALLDIR):
  93.     $(MKDIRS) $(DSTROOT)$(INSTALLDIR)
  94.  
  95. before_install:: $(DSTROOT)$(INSTALLDIR)
  96.     $(RM) -rf $(DSTROOT)$(INSTALLDIR)/$(PRODUCT_ROOT)
  97.  
  98. after_install::
  99.  
  100. install:: project before_install $(OTHER_INSTALL_DEPENDS)
  101.     $(TAR) cf - $(PRODUCT_ROOT) | (cd $(DSTROOT)$(INSTALLDIR); $(TAR) xf -)
  102.     @somebundles=no; \
  103.     for i in $(BUNDLES:.bproj=) none ; do \
  104.         if [ $$i = none ] ; then continue; fi; \
  105.         $(ECHO) $(STRIP) $(RELOCATABLE_STRIP_OPTS) $(DSTROOT)$(INSTALLDIR)/$(PRODUCT_ROOT)/$$i.bundle/$$i; \
  106.         $(STRIP) $(RELOCATABLE_STRIP_OPTS) $(DSTROOT)$(INSTALLDIR)/$(PRODUCT_ROOT)/$$i.bundle/$$i; \
  107.     done; \
  108.     $(STRIP) $(RELOCATABLE_STRIP_OPTS) \
  109.             $(DSTROOT)$(INSTALLDIR)/$(PRODUCT_ROOT)/$(BUNDLE)
  110.     -$(CHOWN) -Rf $(INSTALL_AS_USER).$(INSTALL_AS_GROUP) \
  111.         $(DSTROOT)$(INSTALLDIR)/$(PRODUCT_ROOT)
  112.     -$(CHMOD) -Rf go-w $(DSTROOT)$(INSTALLDIR)/$(PRODUCT_ROOT)
  113.     if [ "$(INSTALL_PERMISSIONS)" != "" ] ; then \
  114.         $(CHMOD) -f $(INSTALL_PERMISSIONS) \
  115.             $(DSTROOT)$(INSTALLDIR)/$(PRODUCT_ROOT)/$(BUNDLE); \
  116.     fi
  117.     @$(MAKE) after_install
  118.  
  119. help::
  120.     @$(ECHO) 'The following targets are available:'
  121.     @$(ECHO) 
  122.     @$(ECHO) ' all        Makes the bundle target (below).  This is the default target.'
  123.     @$(ECHO) 
  124.     @$(ECHO) ' bundle     Compiles and links an optimized (and debuggable) version of the'
  125.     @$(ECHO) '            bundle into $(NAME).bundle'
  126.     @$(ECHO)     
  127.     @$(ECHO) ' depend     Generates an optional Makefile.dependencies file for every level'
  128.     @$(ECHO) '            of the bundle to reflect the complete dependency graph'
  129.     @$(ECHO) '            (including headers).'
  130.     @$(ECHO) 
  131.     @$(ECHO) ' install    Builds (if needed) and copies <BundleName>.bundle'
  132.     @$(ECHO) '            into the installation directory, setting permissions'
  133.     @$(ECHO) '            and owners as appropriate.'
  134.     @$(ECHO)     
  135.     @$(ECHO) ' installsrc Installs the source files for the bundle into the directory'
  136.     @$(ECHO) '            specified in the SRCROOT variable in a command-line argument.'
  137.     @$(ECHO) '            Note: the target directory3l be removed and recreated.'
  138.     @$(ECHO) 
  139.     @$(ECHO) ' clean      Removes all files in the bundle derived from previous builds.'
  140.     @$(ECHO) 
  141.     @$(ECHO) ' help       Lists these targets with their descriptions.'
  142.     @$(ECHO) 
  143.     @$(ECHO) 'For more details, see the comments in /NextDeveloper/Makefiles/app/*.make.'
  144.  
  145.