diff options
Diffstat (limited to 'OMakefile')
-rw-r--r-- | OMakefile | 167 |
1 files changed, 133 insertions, 34 deletions
@@ -1,65 +1,164 @@ +###################################################################### + # If you aren't running on a LAMP system, you need to make sure you -# have JAVA_HOME and JAVACMD set correctly +# have JAVA_HOME and JAVACMD (and optionally JAVAC) set correctly. JAVA_HOME = $(getenv JAVA_HOME, /home/linuxsoft/apps/java-1.6/) JAVACMD = $(getenv JAVACMD, /home/linuxsoft/apps/java-1.6/bin/java) +JAVAC = $(getenv JAVAC, $(JAVA_HOME)$(DIRSEP)bin$(DIRSEP)javac) +# Default options for the JVM +JAVA_OPTS = -Xms1024M -Xmx1024M -XX:MaxPermSize=256M -JAVAC = $(JAVA_HOME)$(DIRSEP)bin$(DIRSEP)javac +###################################################################### -COMMON_CLASSPATH = $(addprefix .$(DIRSEP)lib$(DIRSEP), jline.jar msil.jar fjbg.jar) +# The current copyright string +COPYRIGHT_STRING = "Copyright 2002-2008, LAMP/EPFL" +# Need to generate this correctly +VERSION_NUMBER = 2.7.2 -BOOT_CLASSPATH = $(array $(addprefix .$(DIRSEP)lib$(DIRSEP), scala-library.jar scala-compiler.jar) $(COMMON_CLASSPATH)) -DIST_CLASSPATH = $(array $(addprefix .$(DIRSEP)build$(DIRSEP)boot$(DIRSEP), compiler library) $(COMMON_CLASSPATH)) -TEST_CLASSPATH = $(array $(addprefix .$(DIRSEP)build$(DIRSEP)dist$(DIRSEP), compiler library partest) $(COMMON_CLASSPATH)) +# The directory where the STARR is kept +LIB_DIR = .$(DIRSEP)lib +# The directory where we store the built files +BUILD_DIR = .$(DIRSEP)build +# The directory where the locker files are kept +LOCKER_DIR = $(BUILD_DIR)$(DIRSEP)locker +LOCKER_CLASS_DIR = $(LOCKER_DIR)$(DIRSEP)classes +# The directory where the quick files are kept +QUICK_DIR = $(BUILD_DIR)$(DIRSEP)quick +QUICK_CLASS_DIR = $(QUICK_DIR)$(DIRSEP)classes -JAVA_OPTS = -Xms1024M -Xmx1024M -XX:MaxPermSize=256M +# Scala compiler class +SCALAC_CLASS = scala.tools.nsc.Main -.PHONY : boot dist clean test +# The Partest class +PARTEST_CLASS = scala.tools.partest.nest.NestRunner -.DEFAULT : test +# Arguments used to configure which tests are run +PARTEST_ARGS = --pos --neg --run --jvm --jvm5 --res --shootout + +###################################################################### + +# CLASSPATHs for the various build modes +COMMON_CLASSPATH = $(addprefix $(LIB_DIR)$(DIRSEP), jline.jar msil.jar fjbg.jar) + +STARR_CLASSPATH = $(array $(addprefix $(LIB_DIR)$(DIRSEP), scala-library.jar scala-compiler.jar) $(COMMON_CLASSPATH)) +# Debugging remove +#println($(string $(STARR_CLASSPATH))) +LOCKER_CLASSPATH = $(array $(addprefix $(LOCKER_CLASS_DIR)$(DIRSEP), compiler library) $(COMMON_CLASSPATH)) +QUICK_CLASSPATH = $(array $(addprefix $(QUICK_CLASS_DIR)$(DIRSEP), compiler library partest) $(COMMON_CLASSPATH)) -cond-mkdir(dir) = +###################################################################### + +# Helper functions + +# Convert a sequence to a path by concatenating it together with +# the appropriate separator for the current platform +topath(seq) = + return $(concat $(PATHSEP), $(seq)) + +# Create an empty file +touch(file) = + close($(fopen $(file), w)) + +# "idempotent-mkdir", create a directory if it doesn't already exist +idem-mkdir(dir) = if $(not $(file-exists $(dir))) # println(Creating directory $(dir)) mkdir(-p $(dir)) +# Write a property file +propfile(file) = + handle = $(fopen $(file), w) + # Need to correctly generated date/time + fprint($(handle), "# Generated at some time") + fprint($(handle), "copyright.string="$(COPYRIGHT_STRING)) + fprint($(handle), "version.number="$(VERSION_NUMBER)) + close($(handle)) + +# Compile the Scala files in the sequence args with the specified +# classpath, placing the generated class files in the directory outdir scalac(classpath, outdir, args) = # println(scalac compiling $(string $(args))) - $(JAVACMD) -cp $(concat $(PATHSEP), $(classpath)) $(JAVA_OPTS) scala.tools.nsc.Main -d $(outdir) $(args) - -partest(classpath) = - # println(testing) - $(JAVACMD) -cp $(concat $(PATHSEP), $(classpath)) $(JAVA_OPTS) \ - scala.tools.partest.nest.NestRunner --classpath .$(DIRSEP)build$(DIRSEP)dist --show-diff --pos --neg --run --jvm --jvm5 --res --shootout + $(JAVACMD) -cp $(topath $(classpath)) $(JAVA_OPTS) $(SCALAC_CLASS) -d $(outdir) $(args) +# Compile the Java files in the sequence args with the specified +# classpath, placing the generated class files in the directory outdir javac(classpath, outdir, args) = # println(javac compiling $(string $(args))) - $(JAVAC) -cp $(concat $(PATHSEP), $(classpath)) -d $(outdir) $(args) + $(JAVAC) -cp $(topath $(classpath)) -d $(outdir) $(args) +# Build an instance of the Scala compiler and libraries using +# the compiler in the specified classpath as the bootstrap +# compiler, and placing the result in the directory outdir buildscala(classpath, outdir) = - cond-mkdir($(outdir)/compiler) - scalac($(classpath), $(outdir)$(DIRSEP)compiler, \ + idem-mkdir($(outdir)$(DIRSEP)classes$(DIRSEP)compiler) + scalac($(classpath), $(outdir)$(DIRSEP)classes$(DIRSEP)compiler, \ $(find ./src/compiler/scala/tools/nsc -name *.scala) $(find ./src/compiler/scala/tools/util -name *.scala)) - cond-mkdir($(outdir)/library) - javac($(classpath), $(outdir)$(DIRSEP)library, $(find ./src/library -name *.java) $(find ./src/actors -name *.java)) - scalac($(classpath), $(outdir)$(DIRSEP)library, $(find ./src/library -name *.scala) $(find ./src/actors -name *.scala)) - cond-mkdir($(outdir)/partest) + propfile($(outdir)$(DIRSEP)classes$(DIRSEP)compiler$(DIRSEP)compiler.properties) + # For compatibility with the old ant script we'll create a flag + # touch($(outdir)$(DIRSEP)compiler.complete) + idem-mkdir($(outdir)$(DIRSEP)classes$(DIRSEP)library) + javac($(classpath), $(outdir)$(DIRSEP)classes$(DIRSEP)library, \ + $(find ./src/library -name *.java) $(find ./src/actors -name *.java)) + scalac($(classpath), $(outdir)$(DIRSEP)classes$(DIRSEP)library, \ + $(find ./src/library -name *.scala) \ + $(find ./src/dbc -name *.scala) \ + $(find ./src/swing -name *.scala) \ + $(find ./src/actors -name *.scala)) # Need to copy over script.js and style.css for scaladoc to find them - cp($(addprefix ./src/compiler/scala/tools/nsc/doc/,script.js style.css) $(outdir)/compiler/scala/tools/nsc/doc) + cp($(addprefix ./src/compiler/scala/tools/nsc/doc/,script.js style.css) \ + $(outdir)$(DIRSEP)classes$(DIRSEP)compiler$(DIRSEP)scala$(DIRSEP)tools$(DIRSEP)nsc$(DIRSEP)doc) + propfile($(outdir)$(DIRSEP)classes$(DIRSEP)compiler$(DIRSEP)library.properties) + # For compatibility with the old ant script we'll create some flags + touch($(outdir)$(DIRSEP)library.complete) + # touch($(outdir)$(DIRSEP)all.complete) + +# Run partest with respect to the specified classpath +partest(classpath) = + # println(testing) + $(JAVACMD) -cp $(topath $(classpath)) $(JAVA_OPTS) \ + $(PARTEST_CLASS) --show-diff $(PARTEST_ARGS) + +###################################################################### +# Specify those targets that are "phony", as in, they do not +# correspond to actual files that will be created. + +.PHONY : locker quick partest test clean all.clean locker.clean + +# Specify the default target +.DEFAULT : test + +###################################################################### + +# Just clean out the quick build clean : - $(rm -rf ./build) + $(rm -rf $(QUICK_DIR)) + +# Just clean out the locker +locker.clean : + $(rm -rf $(LOCKER_DIR)) + +# Clean up everything +all.clean : + $(rm -rf $(BUILD_DIR)) + +###################################################################### + +locker $(LOCKER_DIR) : + buildscala($(STARR_CLASSPATH), $(LOCKER_DIR)) -boot : - buildscala($(BOOT_CLASSPATH), .$(DIRSEP)build$(DIRSEP)boot) +quick $(QUICK_DIR) : $(LOCKER_DIR) + buildscala($(LOCKER_CLASSPATH), $(QUICK_DIR)) -dist : boot - buildscala($(DIST_CLASSPATH), .$(DIRSEP)build$(DIRSEP)dist) - # Build partest - javac($(DIST_CLASSPATH), .$(DIRSEP)build$(DIRSEP)dist$(DIRSEP)partest, \ +partest : quick + idem-mkdir($(QUICK_CLASS_DIR)$(DIRSEP)partest) + javac($(LOCKER_CLASSPATH), $(QUICK_CLASS_DIR)$(DIRSEP)partest, \ $(find ./src/partest/scala -name *.java)) - scalac($(DIST_CLASSPATH), .$(DIRSEP)build$(DIRSEP)dist$(DIRSEP)partest, \ + scalac($(LOCKER_CLASSPATH), $(QUICK_CLASS_DIR)$(DIRSEP)partest, \ $(filter-out %PartestTask.scala %AntRunner.scala, $(find ./src/partest/scala -name *.scala))) + # For compatibility with the old ant script we'll create a flag + # touch($(QUICK_DIR)$(DIRSEP)partest.complete) -test : dist - partest($(TEST_CLASSPATH)) +test : partest + partest($(QUICK_CLASSPATH)) |