home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.bin / SourceCode / GameKit / Makefiles / MusicKit / app.make
Encoding:
Text File  |  1994-06-07  |  11.7 KB  |  273 lines

  1. # This is the same as the /NextDeveloper/Makefiles/ version except that the 
  2. # -ObjC flag has been removed to keep the application from being too large.
  3. # Note that if you use the NeXTstep 3.0 help facility, you may need to 
  4. # explicitly link certain help classes.  For more information on linking,
  5. # see /LocalLibrary/Documentation/MusicKit+DSP/ReleaseNotes/MusicKit.rtf.
  6. #
  7. #                                  app.make
  8. #
  9. # Inputs from Makefile.preamble or Makefile.postamble (no defaults):
  10. #    OTHER_CFLAGS - Flags passed to compiler (in addition to -g, -O, etc.)
  11. #    OTHER_LDFLAGS - Flags passed to ld 
  12. #    OTHER_OFILES - Additional relocatables that may be linked in
  13. #    OTHER_LIBS - Libraries to link with when making app target
  14. #    OTHER_DEBUG_LIBS - Libraries to link with when making debug target
  15. #    OTHER_PROF_LIBS - Libraries to link with when making profile target
  16. #    OTHER_JAPANESE_LIBS - 'app' libraries when $(JAPANESE) = "YES"
  17. #    OTHER_JAPANESE_DEBUG_LIBS - 'debug' libraries when $(JAPANESE) = "YES"
  18. #    OTHER_JAPANESE_PROF_LIBS - 'profile' libs when $(JAPANESE) = "YES"
  19. #    OTHER_PRODUCT_DEPENDS - Other dependencies of this project
  20. #    OTHER_EARLY_TARGETS - Built before building subprojects/bundles
  21. #    OTHER_SOURCEFILES - Other source files maintained by .pre/postamble
  22. #    OTHER_GARBAGE - Additional files to be removed by make 'clean' 
  23. #
  24. #    DSTROOT - Virtual root directory prepended to $(INSTALLDIR)
  25. #
  26. # Inputs from Makefile.preamble:
  27. #    PRECOMPS - Precompiled headers that should be built before compilation 
  28. #    OTHER_INITIAL_TARGETS - Targets to be built before subprojects, etc.
  29. #
  30. # Inputs from Makefile.postamble (with defaults set in common.make):
  31. #    INSTALL_AS_USER - User to chown app to at installation (default root)
  32. #    INSTALL_AS_GROUP - Grp to chgrp app to at installation (default wheel)
  33. #    INSTALL_PERMISSIONS - If set, 'install' chmod's executable to this.
  34. #    MAKEFILES - Makefiles this project depends on (default = Makefile)
  35. #
  36. #    RELOCATABLE_STRIP_OPTS - Opts to strip for bundles (default = -x -u)
  37. #    DYLD_APP_STRIP_OPTS - Opts to strip for apps w/ bundles (def. = -A -n)
  38. #    APP_STRIP_OPTS - Opts to strip for apps w/o bundles (no default, but
  39. #          developers doing their own dynamic loading should set this to 
  40. #          $(DYLD_APP_STRIP_OPTS)
  41. #
  42. # Inputs from Makefile (avoid setting these, ProjectBuilder controls them):
  43. #    NAME - name of application
  44. #    LANGUAGE - langage in which the project is written (default "English")
  45. #    ENGLISH - boolean flag set iff $(LANGUAGE) = "English"
  46. #    JAPANESE - boolean flag set iff $(LANGUAGE) = "Japanese"
  47. #    LOCAL_RESOURCES - localized resources (e.g. nib's, images) of project
  48. #    GLOBAL_RESOURCES - non-localized resources of project
  49. #    PROJECTVERSION - version of ProjectBuilder that output Makefile
  50. #    APPICON - application icon file
  51. #    DOCICONS - dock icon files
  52. #    ICONSECTIONS - Specifies icon sections when linking executable 
  53. #
  54. #    CLASSES - Class implementation files in project.
  55. #    HFILES - Header files in project.
  56. #    MFILES - Other Objective-C source files in project. 
  57. #    CFILES - Other C source files in project. 
  58. #    PSWFILES - .psw files in the project
  59. #    PSWMFILES - .pswm files in the project
  60. #    SUBPROJECTS - Subprojects of this project
  61. #    BUNDLES - Bundle subprojects of this project
  62. #    OTHERSRCS - Other miscellaneous sources of this project
  63. #    OTHERLINKED - Source files not matching a standard source extention
  64. #
  65. #    LIBS - Libraries to link with when making app target
  66. #    DEBUG_LIBS - Libraries to link with when making debug target
  67. #    PROF_LIBS - Libraries to link with when making profile target
  68. #    OTHERLINKEDOFILES - Other relocatable files to (always) link in.
  69. #
  70. #    MAKEFILEDIR - Directory in which to find this generic set of Makefiles
  71. #    INSTALLDIR - Directory app will be installed into by 'install' target
  72. #    INSTALLFLAGS - not used
  73. #    SOURCEMODE - not used
  74. #
  75. # Outputs from this file to common.make:
  76. #    OFILE_DIR
  77. #
  78.  
  79. APPICONFLAGS =  -sectcreate __ICON __header $(NAME).iconheader  \
  80.         -segprot __ICON r r $(ICONSECTIONS)
  81.  
  82. ICONHEADER = $(NAME).iconheader
  83.  
  84. include /NextDeveloper/Makefiles/app/common.make
  85.  
  86. all:: app
  87.  
  88.     
  89. app::
  90.     @($(MKDIRS) $(NAME).app ; \
  91.     if [ "$(ENGLISH)" = "YES" -o "$(JAPANESE)" != "YES" ] ; then \
  92.     $(MAKE) project \
  93.         "PRODUCT_ROOT = $(NAME).app" \
  94.         "PRODUCT = $(NAME).app/$(NAME)" \
  95.         "OFILE_DIR=obj" \
  96.         "CFLAGS = -g -O -Wall $(CFLAGS) $(OTHER_CFLAGS)" \
  97.         "MAKEFILEDIR = $(MAKEFILEDIR)" ; \
  98.     else \
  99.     $(MAKE) project \
  100.         "PRODUCT_ROOT = $(NAME).app" \
  101.         "PRODUCT = $(NAME).app/$(NAME)" \
  102.         "OFILE_DIR=obj" \
  103.         "CFLAGS = -g -O -Wall -DKANJI $(CFLAGS) $(OTHER_CFLAGS)" \
  104.         "LIBS = $(LIBS:lNeXT_s=lNeXTJ_s)" \
  105.         "OTHER_LIBS = $(OTHER_LIBS:lNeXT_s=lNeXTJ_s)" \
  106.         "MAKEFILEDIR = $(MAKEFILEDIR)" ; \
  107.     fi )
  108.  
  109. debug::
  110.     @($(MKDIRS) $(NAME).debug ; \
  111.     if [ "$(ENGLISH)" = "YES" -o "$(JAPANESE)" != "YES" ] ; then \
  112.     $(MAKE) project \
  113.         "PRODUCT_ROOT = $(NAME).debug" \
  114.         "PRODUCT = $(NAME).debug/$(NAME)" \
  115.         "OFILE_DIR=debug_obj" \
  116.         "CFLAGS = -g -Wall -DDEBUG $(CFLAGS) $(OTHER_CFLAGS)" \
  117.         "LIBS = $(DEBUG_LIBS)" "OTHER_LIBS = $(OTHER_DEBUG_LIBS)" \
  118.         "MAKEFILEDIR = $(MAKEFILEDIR)" ; \
  119.     else \
  120.     $(MAKE) project \
  121.         "PRODUCT_ROOT = $(NAME).debug" \
  122.         "PRODUCT = $(NAME).debug/$(NAME)" \
  123.         "OFILE_DIR=debug_obj" \
  124.         "CFLAGS = -g -Wall -DDEBUG -DKANJI $(CFLAGS) $(OTHER_CFLAGS)" \
  125.         "LIBS = $(DEBUG_LIBS:lNeXT_s=lNeXTJ_s)" \
  126.         "OTHER_LIBS = $(OTHER_DEBUG_LIBS:lNeXT_s=lNeXTJ_s)" \
  127.         "OTHER_JAPANESE_LIBS = $(OTHER_JAPANESE_DEBUG_LIBS)" \
  128.         "MAKEFILEDIR = $(MAKEFILEDIR)" ; \
  129.     fi )
  130.  
  131. profile::
  132.     @($(MKDIRS) $(NAME).profile ; \
  133.     if [ "$(ENGLISH)" = "YES" -o "$(JAPANESE)" != "YES" ] ; then \
  134.     $(MAKE) project \
  135.         "PRODUCT_ROOT = $(NAME).profile" \
  136.         "PRODUCT = $(NAME).profile/$(NAME)" \
  137.         "OFILE_DIR=profile_obj" \
  138.         "CFLAGS = -g -pg -O -Wall -DPROFILE $(CFLAGS) $(OTHER_CFLAGS)" \
  139.         "LIBS = $(PROF_LIBS)" "OTHER_LIBS = $(OTHER_PROF_LIBS)" \
  140.         "MAKEFILEDIR = $(MAKEFILEDIR)" ; \
  141.     else \
  142.     $(MAKE) project \
  143.         "PRODUCT_ROOT = $(NAME).profile" \
  144.         "PRODUCT = $(NAME).profile/$(NAME)" \
  145.         "OFILE_DIR=profile_obj" \
  146.         "CFLAGS = -g -pg -O -Wall -DPROFILE -DKANJI $(CFLAGS) $(OTHER_CFLAGS)" \
  147.         "LIBS = $(PROF_LIBS:lNeXT_s=lNeXTJ_s)" \
  148.         "OTHER_LIBS = $(OTHER_PROF_LIBS:lNeXT_s=lNeXTJ_s)" \
  149.         "OTHER_JAPANESE_LIBS = $(OTHER_JAPANESE_PROF_LIBS)" \
  150.         "MAKEFILEDIR = $(MAKEFILEDIR)" ; \
  151.     fi )
  152.  
  153.  
  154.  
  155. depend:: Makefile.dependencies $(SUBPROJECTS:.subproj=.depend) $(BUNDLES:.bproj=.depend)
  156.  
  157. # Note: The order of the following project dependencies is very important.  subcomponents must be after $(PROJECT_OFILES) in case a subcomponent relies upon something (e.g. generated .h file) at the top level, but all subprojects must be built (hopefully by one invocation of make in that subdirectory) before the $(PRODUCT) can be linked.
  158.  
  159. project::   $(INITIAL_TARGETS) subcomponents resources $(PRODUCT)
  160.     -@($(RM) -f $(CHANGES_FILE) ; $(TOUCH) $(CHANGES_FILE))
  161.     
  162. $(PRODUCT): $(PRODUCT_DEPENDS) $(OTHER_PRODUCT_DEPENDS) 
  163.     @(adaptors="" ; \
  164.     for adaptor in $(OTHERRELOCATABLES) none ; do \
  165.         if [ $$adaptor = "none" ] ; then break; fi ; \
  166.         for path in $(ADAPTOR_SEARCH_PATH) none ; do \
  167.             if [ $$path = "none" ] ; then break; fi ;\
  168.             if [ -r $$path/$$adaptor ] ; then \
  169.             adaptors="$$adaptors $$path/$$adaptor" ; \
  170.             break ; \
  171.         fi ; \
  172.         done ; \
  173.     done ; \
  174.     if [ "$(PROJECTVERSION)" -lt "1" -o "$(PROJECTVERSION)" = "1.0" ] ; then \
  175.         if [ "$(ENGLISH)" = "YES" -o "$(JAPANESE)" != "YES" ] ; then \
  176.         $(ECHO) "$(CC) $(CFLAGS) $(LDFLAGS) $(OTHER_LDFLAGS) $(APPICONFLAGS) -o $(PRODUCT) \
  177.             $(OFILES) $(OTHER_OFILES) $$adaptors $(OTHER_LIBS) $(LIBS)" ; \
  178.         $(CC) $(CFLAGS) $(LDFLAGS) $(OTHER_LDFLAGS) $(APPICONFLAGS) -o $(PRODUCT) \
  179.             $(OFILES) $(OTHER_OFILES) $$adaptors $(OTHER_LIBS) $(LIBS) ; \
  180.         else \
  181.         $(ECHO) "$(CC) $(CFLAGS) $(LDFLAGS) $(OTHER_LDFLAGS) $(APPICONFLAGS) -o $(PRODUCT) \
  182.             $(OFILES) $(OTHER_OFILES) $$adaptors $(OTHER_JAPANESE_LIBS) \
  183.             $(OTHER_LIBS) $(LIBS)" ; \
  184.         $(CC) $(CFLAGS) $(LDFLAGS) $(OTHER_LDFLAGS) $(APPICONFLAGS) -o $(PRODUCT) \
  185.             $(OFILES) $(OTHER_OFILES) $$adaptors $(OTHER_JAPANESE_LIBS) \
  186.             $(OTHER_LIBS) $(LIBS) ; \
  187.         fi ; \
  188.     else \
  189.         if [ "$(ENGLISH)" = "YES" -o "$(JAPANESE)" != "YES" ] ; then \
  190.         $(ECHO) "$(CC) $(CFLAGS)  $(LDFLAGS) $(OTHER_LDFLAGS) $(APPICONFLAGS) -o $(PRODUCT) \
  191.             $(OFILES) $(OTHER_OFILES) $$adaptors $(OTHER_LIBS) $(LIBS)" ; \
  192.         $(CC) $(CFLAGS)  $(LDFLAGS) $(OTHER_LDFLAGS) $(APPICONFLAGS) -o $(PRODUCT) \
  193.             $(OFILES) $(OTHER_OFILES) $$adaptors $(OTHER_LIBS) $(LIBS) ; \
  194.         else \
  195.         $(ECHO) "$(CC) $(CFLAGS)  $(LDFLAGS) $(OTHER_LDFLAGS) $(APPICONFLAGS) -o $(PRODUCT) \
  196.             $(OFILES) $(OTHER_OFILES) $$adaptors $(OTHER_JAPANESE_LIBS) \
  197.             $(OTHER_LIBS) $(LIBS)" ; \
  198.         $(CC) $(CFLAGS)  $(LDFLAGS) $(OTHER_LDFLAGS) $(APPICONFLAGS) -o $(PRODUCT) \
  199.             $(OFILES) $(OTHER_OFILES) $$adaptors $(OTHER_JAPANESE_LIBS) \
  200.             $(OTHER_LIBS) $(LIBS) ; \
  201.         fi ; \
  202.     fi)
  203.  
  204. $(DSTROOT)$(INSTALLDIR):
  205.     $(MKDIRS) $(DSTROOT)$(INSTALLDIR)
  206.  
  207. before_install:: $(DSTROOT)$(INSTALLDIR)
  208.     $(RM) -rf $(DSTROOT)$(INSTALLDIR)/$(NAME).app
  209.  
  210. after_install::
  211.  
  212. install:: app before_install $(OTHER_INSTALL_DEPENDS)
  213.     $(TAR) cf - $(NAME).app | (cd $(DSTROOT)$(INSTALLDIR); $(TAR) xf -)
  214.     @somebundles=no; \
  215.     for i in $(BUNDLES:.bproj=) none ; do \
  216.         if [ $$i = none ] ; then continue; fi; \
  217.         somebundles=yes; \
  218.         $(ECHO) $(STRIP) $(RELOCATABLE_STRIP_OPTS) $(DSTROOT)$(INSTALLDIR)/$(NAME).app/$$i.bundle/$$i; \
  219.         $(STRIP) $(RELOCATABLE_STRIP_OPTS) $(DSTROOT)$(INSTALLDIR)/$(NAME).app/$$i.bundle/$$i; \
  220.     done; \
  221.     if [ $$somebundles = yes ] ; then \
  222.         $(ECHO) $(STRIP) $(DYLD_APP_STRIP_OPTS) $(DSTROOT)$(INSTALLDIR)/$(NAME).app/$(NAME); \
  223.         $(STRIP) $(DYLD_APP_STRIP_OPTS) $(DSTROOT)$(INSTALLDIR)/$(NAME).app/$(NAME); \
  224.     else \
  225.         $(ECHO) $(STRIP) $(APP_STRIP_OPTS) $(DSTROOT)$(INSTALLDIR)/$(NAME).app/$(NAME); \
  226.         $(STRIP) $(APP_STRIP_OPTS) $(DSTROOT)$(INSTALLDIR)/$(NAME).app/$(NAME); \
  227.     fi
  228.     $(RM) -f $(DSTROOT)$(INSTALLDIR)/$(NAME).app/$(CHANGES_FILE)
  229.     -$(CHOWN) -Rf $(INSTALL_AS_USER).$(INSTALL_AS_GROUP) \
  230.         $(DSTROOT)$(INSTALLDIR)/$(NAME).app
  231.     -$(CHMOD) -Rf go-w $(DSTROOT)$(INSTALLDIR)/$(NAME).app
  232.     if [ "$(INSTALL_PERMISSIONS)" != "" ] ; then \
  233.         $(CHMOD) -f $(INSTALL_PERMISSIONS) \
  234.             $(DSTROOT)$(INSTALLDIR)/$(NAME).app/$(NAME); \
  235.     fi
  236.     @$(MAKE) after_install
  237.  
  238.  
  239. help::
  240.     @$(ECHO) 'The following targets are available:'
  241.     @$(ECHO) 
  242.     @$(ECHO) ' all        Makes the app target (below).  This is the default target.'
  243.     @$(ECHO) 
  244.     @$(ECHO) ' app        Compiles and links an optimized (and debuggable) version of the'
  245.     @$(ECHO) '            project, ready to install, into <ProjectName>.app.'
  246.     @$(ECHO)      
  247.     @$(ECHO) ' debug      Compiles (with all warnings and -DDEBUG on) and links a '
  248.     @$(ECHO) '            fully-debuggable version of the project into a <ProjectName>.debug' 
  249.     @$(ECHO) '            "app wrapper".'
  250.     @$(ECHO) 
  251.     @$(ECHO) ' profile    Compiles (with all warnings and -DPROFILE on) and links a'
  252.     @$(ECHO) '            version of the project into <ProjectName>.profile.'
  253.     @$(ECHO) '            "app wrapper" that will, when run, generate a gprof report.'
  254.     @$(ECHO) 
  255.     @$(ECHO) ' depend     Generates an optional Makefile.dependencies file for every level'
  256.     @$(ECHO) '            of the project to reflect the complete dependency graph'
  257.     @$(ECHO) '            (including headers).'
  258.     @$(ECHO) 
  259.     @$(ECHO) ' install    Builds (if needed) and copies <ProjectName>.app into the'
  260.     @$(ECHO) '            installation directory, setting permissions and owners as'
  261.     @$(ECHO) '            appropriate.'
  262.     @$(ECHO) 
  263.     @$(ECHO) ' installsrc Installs the source files for the project into the directory'
  264.     @$(ECHO) '            specified in the SRCROOT variable in a command-line argument.'
  265.     @$(ECHO) '            Note: the target directory will be removed and recreated.'
  266.     @$(ECHO)        
  267.     @$(ECHO) ' clean      Removes all files in the project derived from previous builds.'
  268.     @$(ECHO)  
  269.     @$(ECHO) ' help       Lists these targets with their descriptions.'
  270.     @$(ECHO) 
  271.     @$(ECHO) 'For more details, see the comments in /NextDeveloper/Makefiles/app/*.make.'
  272.