###############################################################################
#  NeXT Makefile.postamble Template
#  Copyright 1993, NeXT Computer, Inc.
#
#  This Makefile is used for configuring the standard app makefiles associated
#  with ProjectBuilder.  
#  
#  Use this template to set attributes for a project, sub-project, bundle, or
#  palette.  Each node in the project's tree of sub-projects and bundles 
#  should have it's own Makefile.preamble and Makefile.postamble.  Additional
#  rules (e.g., after_install) that are defined by the developer should be
#  defined in this file.
#
###############################################################################
# 
# Here are the variables exported by the common "app" makefiles that can be 
# used in any customizations you make to the template below:
# 
#	PRODUCT_ROOT - Name of top-level app-wrapper (e.g., Webster.app)
#	OFILE_DIR - Directory into which .o object files are generated.
#		    (Note that this name is calculated based on the target 
#		     architectures specified in Project Builder).
#	DERIVED_SRC_DIR - Directory used for all other derived files
#	ALL_CFLAGS - All the flags passed to the cc(1) driver for compilations
#
#	NAME - name of application, bundle, subproject, palette, etc.
#	LANGUAGE - langage in which the project is written (default "English")
#	ENGLISH - boolean flag set iff $(LANGUAGE) = "English"
#	JAPANESE - boolean flag set iff $(LANGUAGE) = "Japanese"
#	LOCAL_RESOURCES - localized resources (e.g. nib's, images) of project
#	GLOBAL_RESOURCES - non-localized resources of project
#	PROJECTVERSION - version of ProjectBuilder that output Makefile
#	APPICON - application icon file
#	DOCICONS - dock icon files
#	ICONSECTIONS - Specifies icon sections when linking executable 
#
#	CLASSES - Class implementation files in project.
#	HFILES - Header files in project.
#	MFILES - Other Objective-C source files in project. 
#	CFILES - Other C source files in project. 
#	PSWFILES - .psw files in the project
#	PSWMFILES - .pswm files in the project
#	SUBPROJECTS - Subprojects of this project
#	BUNDLES - Bundle subprojects of this project
#	OTHERSRCS - Other miscellaneous sources of this project
#	OTHERLINKED - Source files not matching a standard source extention
#
#	LIBS - Libraries to link with when making app target
#	DEBUG_LIBS - Libraries to link with when making debug target
#	PROF_LIBS - Libraries to link with when making profile target
#	OTHERLINKEDOFILES - Other relocatable files to (always) link in.
#
#	APP_MAKEFILE_DIR - Directory in which to find generic set of Makefiles
#	MAKEFILEDIR - Directory in which to find $(MAKEFILE)
#	MAKEFILE - Top level mechanism Makefile (e.g., app.make, bundle.make)
#	INSTALLDIR - Directory app will be installed into by 'install' target

#MAKEFILES = Makefile 

OPTIMIZATION_CFLAG = -O4
NORMAL_CFLAGS = $(OPTIMIZATION_CFLAG) -ObjC
DEBUG_CFLAGS = -g -Wall -DDEBUG
PACKAGE_LOCATION = /Disks/PublicDomain

# ***************** Packageing ****************

package:: all packagestrip packageproject packageinstall

packageproject::
	@/bin/mkdirs $(NAME)
	@rm -r $(NAME)/$(NAME).app
	@/bin/mv $(NAME).app $(NAME)
	/NextAdmin/Installer.app/package -B $(NAME) $(NAME).info
	@/bin/mv $(NAME)/$(NAME).app .
	@/bin/rmdir $(NAME)

packagestrip::
	-@somebundles=no; \
	for i in $(BUNDLES:.bproj=) none ; do \
		if [ $$i = none ] ; then continue; fi; \
		somebundles=yes; \
		$(ECHO) $(STRIP) $(RELOCATABLE_STRIP_OPTS) ./$(NAME).app/$$i.$(BUNDLE_EXTENSION)/$$i; \
		$(STRIP) $(RELOCATABLE_STRIP_OPTS) ./$(NAME).app/$$i.$(BUNDLE_EXTENSION)/$$i; \
	done; \
	if [ $$somebundles = yes ] ; then \
		$(ECHO) $(STRIP) $(DYLD_APP_STRIP_OPTS) ./$(NAME).app/$(NAME); \
		$(STRIP) $(DYLD_APP_STRIP_OPTS) ./$(NAME).app/$(NAME); \
	else \
		$(ECHO) $(STRIP) $(APP_STRIP_OPTS) ./$(NAME).app/$(NAME); \
		$(STRIP) $(APP_STRIP_OPTS) ./$(NAME).app/$(NAME); \
	fi

packageinstall::
	@if [ "$(PACKAGE_LOCATION)" != "" ] ; then \
		rm -r $(PACKAGE_LOCATION)/$(NAME).pkg ;\
		mv $(NAME).pkg $(PACKAGE_LOCATION) ;\
		$(ECHO) mv $(NAME).pkg $(PACKAGE_LOCATION) ;\
	fi






