188 lines
7.2 KiB
Plaintext
188 lines
7.2 KiB
Plaintext
######################################################################
|
|
|
|
# If you aren't running on a LAMP system, you need to make sure you
|
|
# have JAVA_HOME and JAVACMD (and optionally JAVAC) set correctly.
|
|
JAVA_HOME = $(getenv JAVA_HOME, /home/linuxsoft/apps/java-1.6/)
|
|
JAVACMD = $(getenv JAVACMD, $(JAVA_HOME)$(DIRSEP)bin$(DIRSEP)java)
|
|
JAVAC = $(getenv JAVAC, $(JAVA_HOME)$(DIRSEP)bin$(DIRSEP)javac)
|
|
JAVAP = $(JAVA_HOME)$(DIRSEP)bin$(DIRSEP)javap
|
|
|
|
# Default options for the JVM
|
|
JAVA_OPTS = -Xms1024M -Xmx1024M -XX:MaxPermSize=256M
|
|
|
|
DIFF=diff
|
|
DIFF_OPTS=-r
|
|
|
|
######################################################################
|
|
|
|
# The current copyright string
|
|
COPYRIGHT_STRING = Copyright 2002-2009, LAMP/EPFL
|
|
# Need to generate this correctly
|
|
VERSION_NUMBER = 2.7.2
|
|
|
|
# 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
|
|
# The directory where the strap files are kept
|
|
STRAP_DIR = $(BUILD_DIR)$(DIRSEP)strap
|
|
STRAP_CLASS_DIR = $(STRAP_DIR)$(DIRSEP)classes
|
|
|
|
# Scala compiler class
|
|
SCALAC_CLASS = scala.tools.nsc.Main
|
|
|
|
# The Partest class
|
|
PARTEST_CLASS = scala.tools.partest.nest.NestRunner
|
|
|
|
# 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))
|
|
STRAP_CLASSPATH = $(array $(addprefix $(STRAP_CLASS_DIR)$(DIRSEP), compiler library partest) $(COMMON_CLASSPATH))
|
|
|
|
######################################################################
|
|
|
|
# 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))
|
|
|
|
# compare two classes using javap
|
|
javap-diff(cpath1, cpath2, cls) =
|
|
tmp1 = $(tmpfile javap1, .txt)
|
|
tmp2 = $(tmpfile javap2, .txt)
|
|
$(JAVAP) -classpath $(cpath1) -private $(cls) > $(tmp1)
|
|
$(JAVAP) -classpath $(cpath2) -private $(cls) > $(tmp2)
|
|
($(DIFF) $(tmp1) $(tmp2)) || echo $(cls) is different in $(cpath1) and $(cpath2)
|
|
|
|
# Write a property file
|
|
propfile(file) =
|
|
handle = $(fopen $(file), w)
|
|
# Need to correctly generated date/time
|
|
fprint($(handle), \# Generated at some time\n)
|
|
fprint($(handle), copyright.string=$(COPYRIGHT_STRING)\n)
|
|
fprint($(handle), version.number=$(VERSION_NUMBER)\n)
|
|
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 $(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 $(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) =
|
|
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))
|
|
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)$(DIRSEP)classes$(DIRSEP)compiler$(DIRSEP)scala$(DIRSEP)tools$(DIRSEP)nsc$(DIRSEP)doc)
|
|
propfile($(outdir)$(DIRSEP)classes$(DIRSEP)library$(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) --classpath $(QUICK_CLASS_DIR) --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 strap stability
|
|
|
|
# Specify the default target
|
|
.DEFAULT : test
|
|
|
|
######################################################################
|
|
|
|
# Just clean out the quick build
|
|
clean :
|
|
$(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))
|
|
|
|
quick $(QUICK_DIR) : $(LOCKER_DIR)
|
|
buildscala($(LOCKER_CLASSPATH), $(QUICK_DIR))
|
|
|
|
strap $(STRAP_DIR) : $(QUICK_DIR)
|
|
buildscala($(QUICK_CLASSPATH), $(STRAP_DIR))
|
|
|
|
test.stability : $(STRAP_DIR)
|
|
# javap-diff($(QUICK_CLASS_DIR)/library, $(STRAP_CLASS_DIR)/library, "scala.swing.Key")
|
|
$(DIFF) $(DIFF_OPTS) $(QUICK_CLASS_DIR) $(STRAP_CLASS_DIR)
|
|
|
|
partest : quick
|
|
idem-mkdir($(QUICK_CLASS_DIR)$(DIRSEP)partest)
|
|
javac($(LOCKER_CLASSPATH), $(QUICK_CLASS_DIR)$(DIRSEP)partest, \
|
|
$(find ./src/partest/scala -name *.java))
|
|
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 : partest
|
|
partest($(QUICK_CLASSPATH))
|