#======================================================================== # # NAME # # makefile # # DESCRIPTION # # Makefile for UNIX systems and Windows + Cygwin for # cleaning up, compiling, documenting, running and debugging the # Prentice application. # # NOTES # # # # LEGAL # # Prentice Version 1.1 - An Artist's Software Apprentice. # Copyright (C) 2003-2008 by Sean Erik O'Connor. All Rights Reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # The author's address is artifex@seanerikoconnor.freeservers.com. # #============================================================================= # Parent directory for all the package directories containing all the source code. # e.g. the package "Prentice" has directory ../SourceCode/Prentice and contains # ../SourceCode/Prentice/Prentice.java as the main file. CLASSPATH=../SourceCode # Main package directory. MAIN_PACKAGE_DIR = Prentice export MAIN_PACKAGE_DIR # Top level directory of the compiled *.class files. # e.g. the package "Model" has directory ../class/Model and contains # the file ../Model/Model.class as one of its classes. CLASS_DIR = ../class # Java compiler. JAVAC = javac # Java interpreter. JAVA = java # Java debugger. JDB = jdb # -g Compile for debugging. DFLAGS = # "Executable" EXE_FILE = $(CLASS_DIR)/Prentice.class # Forced remove $(RM) = rm -f # Make all the executables. all: $(EXE_FILE) # Compile source into .class files # # By compiling Prentice.java, we will automatically # compile all .java source files in all the packages. # $(EXE_FILE): echo "Searching classpath = $(CLASSPATH), source files from $(MAIN_PACKAGE_DIR), classes put into $(CLASS_DIR)" $(JAVAC) $(DFLAGS) -classpath $(CLASSPATH) -d $(CLASS_DIR) $(CLASSPATH)/$(MAIN_PACKAGE_DIR)/*.java # Point to the directory containing the .class files and give the name # of the main package and main class name. test: $(EXE_FILE) $(JAVA) -cp $(CLASS_DIR) Prentice.Prentice # Create Javadoc style html documentation from source code. Include all private, protected and public fields. doc: javadoc -classpath $(CLASSPATH) -private Prentice Model View -d ../doc jar: echo "Java jar cannot handle relative directory paths!!!!" echo "You have to do this manually." echo "cd $(CLASS_DIR)" echo "rm -rf Prentice.jar" echo "jar -cmfv manifest.txt Prentice.jar Prentice Model View Render" echo "java -jar Prentice.jar" # Clean up. clean: # Delete old classes and JAR files. $(RM) ../class/Prentice/*.class $(RM) ../class/Model/*.class $(RM) ../class/View/*.class $(RM) ../class/Render/*.class $(RM) Prentice.jar # Delete VIM editor backup files. $(RM) ../SourceCode/Prentice/*.java~ $(RM) ../SourceCode/Model/*.java~ $(RM) ../SourceCode/View/*.java~ $(RM) ../SourceCode/Render/*.java~ # Delete generated images and debug log. $(RM) ../data/rendered.jpg $(RM) ../data/rendered.png $(RM) ../data/log.txt $(RM) profile.txt $(RM) gclog.txt $(RM) log.txt # Run with Logging and Profiling # # -ea Enable assertions for extra checking. # # -verbose:gc Turn on garbage collection logging... # -Xloggc:gclog.txt ... and dump to file gclog.txt # # 0.114: [Full GC 738K->738K(1984K), 0.0247674 secs] # 0.156: [GC 3849K->3828K(5060K), 0.0019430 secs] # :[heap before]->[heap after(total heap)] # # -Xprof Turn on profiling. Send to file profile.txt # profile: $(EXE_FILE) $(JAVA) -cp $(CLASS_DIR) -ea -verbose:gc -Xloggc:gclog.txt -Xprof Prentice.Prentice > profile.txt