summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-03-11 09:54:27 +0000
committerpaltherr <paltherr@epfl.ch>2003-03-11 09:54:27 +0000
commit2ad302331f15da514ecbcf4ffc8e96a1102fedb6 (patch)
treea853811e7b6081e108183ba481ffe6fc35812014 /support
parentace3aba1de91cdac9513e4b106055ccc965aef7b (diff)
downloadscala-2ad302331f15da514ecbcf4ffc8e96a1102fedb6.tar.gz
scala-2ad302331f15da514ecbcf4ffc8e96a1102fedb6.tar.bz2
scala-2ad302331f15da514ecbcf4ffc8e96a1102fedb6.zip
- Added jc.mk
Diffstat (limited to 'support')
-rw-r--r--support/make/jc.mk108
1 files changed, 108 insertions, 0 deletions
diff --git a/support/make/jc.mk b/support/make/jc.mk
new file mode 100644
index 0000000000..f2e84f63e5
--- /dev/null
+++ b/support/make/jc.mk
@@ -0,0 +1,108 @@
+############################################################-*-Makefile-*-####
+# JC - Compile Java Files
+##############################################################################
+# $Id$
+
+##############################################################################
+# Usage
+#
+# make jc [target=<target>] [<VARIABLE>=<value>]
+#
+##############################################################################
+# Variables
+#
+# JC_COMPILER = compiler name, for example JAVAC
+# $(JC_COMPILER) = compiler command
+# $(JC_COMPILER)_FLAGS = compiler-specific compilation flags
+# JC_FLAGS += compilation flags
+# JC_CLASSPATH = location of user class files
+# JC_SOURCEPATH = location of input source files
+# JC_BOOTCLASSPATH = location of bootstrap class files
+# JC_EXTDIRS = location of installed extensions
+# JC_OUTPUTDIR = directory where to place generated class files
+# JC_ENCODING = character encoding used by source files
+# JC_SOURCE = version of source code
+# JC_TARGET = version of target bytecode
+# JC_FILES += files to compile
+#
+# All variables may have target specific values which override the
+# normal value. Those values are specified by variables whose name is
+# prefixed with the target name. For example, to override the value of
+# the variable JC_CLASSPATH with target COMPILER, one may define the
+# variable COMPILER_JC_CLASSPATH
+#
+##############################################################################
+# Examples
+#
+# Compile file "sources/scalac/Main.java"
+#
+# make jc JC_FILES=sources/scalac/Main.java
+#
+#
+# Compile the whole runtime
+#
+# make jc target=RUNTIME
+#
+#
+# A Makefile rule that compiles all modified files from the runtime
+#
+# .latest-runtime : $(RUNTIME_JC_FILES)
+# @$(MAKE) jc target=RUNTIME RUNTIME_JC_FILES='$?'
+# touch $@
+#
+##############################################################################
+
+##############################################################################
+# Defaults
+
+JC_COMPILER ?= JAVAC
+JAVAC ?= javac
+
+##############################################################################
+# Values
+
+jc_COMPILER = $(call JC_LOOKUP,JC_COMPILER)
+jc_compiler = $(call JC_LOOKUP,$(jc_COMPILER))
+jc_compiler_flags = $(call JC_LOOKUP,$(jc_COMPILER)_FLAGS)
+jc_FLAGS = $(call JC_LOOKUP,JC_FLAGS)
+jc_CLASSPATH = $(call JC_LOOKUP,JC_CLASSPATH)
+jc_SOURCEPATH = $(call JC_LOOKUP,JC_SOURCEPATH)
+jc_BOOTCLASSPATH = $(call JC_LOOKUP,JC_BOOTCLASSPATH)
+jc_EXTDIRS = $(call JC_LOOKUP,JC_EXTDIRS)
+jc_OUTPUTDIR = $(call JC_LOOKUP,JC_OUTPUTDIR)
+jc_ENCODING = $(call JC_LOOKUP,JC_ENCODING)
+jc_SOURCE = $(call JC_LOOKUP,JC_SOURCE)
+jc_TARGET = $(call JC_LOOKUP,JC_TARGET)
+jc_FILES = $(call JC_LOOKUP,JC_FILES)
+
+##############################################################################
+# Command
+
+jc += $(jc_compiler)
+jc += $(jc_compiler_flags)
+jc += $(jc_FLAGS)
+jc += $(jc_CLASSPATH:%=-classpath %)
+jc += $(jc_SOURCEPATH:%=-sourcepath %)
+jc += $(jc_BOOTCLASSPATH:%=-bootclasspath %)
+jc += $(jc_EXTDIRS:%=-extdirs %)
+jc += $(jc_OUTPUTDIR:%=-d %)
+jc += $(jc_ENCODING:%=-encoding %)
+jc += $(jc_SOURCE:%=-source %)
+jc += $(jc_TARGET:%=-target %)
+jc += $(jc_FILES)
+
+##############################################################################
+# Functions
+
+JC_LOOKUP = $(if $($(target)_$(1)),$($(target)_$(1)),$($(1)))
+
+##############################################################################
+# Rules
+
+jc :
+ @[ -d "$(jc_OUTPUTDIR)" ] || $(MKDIR) -p "$(jc_OUTPUTDIR)"
+ $(strip $(jc))
+
+.PHONY : jc
+
+##############################################################################