diff options
author | paltherr <paltherr@epfl.ch> | 2003-08-07 15:20:50 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-08-07 15:20:50 +0000 |
commit | d0da6a1fd07bcf0ea0af64efef694d068b7163cf (patch) | |
tree | 051e2c0db4a175781a2595bb1a7407b829712479 /support/make/sc.mk | |
parent | 59f37b3fec3855b54f182075b731c22a4d8b2925 (diff) | |
download | scala-d0da6a1fd07bcf0ea0af64efef694d068b7163cf.tar.gz scala-d0da6a1fd07bcf0ea0af64efef694d068b7163cf.tar.bz2 scala-d0da6a1fd07bcf0ea0af64efef694d068b7163cf.zip |
- Added sc.mk
Diffstat (limited to 'support/make/sc.mk')
-rw-r--r-- | support/make/sc.mk | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/support/make/sc.mk b/support/make/sc.mk new file mode 100644 index 0000000000..c2a05a973a --- /dev/null +++ b/support/make/sc.mk @@ -0,0 +1,111 @@ +############################################################-*-Makefile-*-#### +# SC - Compile Scala Files +############################################################################## +# $Id$ + +############################################################################## +# Usage +# +# make sc [target=<target>] {<VARIABLE>=<value>} +# +############################################################################## +# Variables +# +# SC_COMPILER = compiler name, for example SCALAC +# $(SC_COMPILER) = compiler command +# $(SC_COMPILER)_FLAGS = compiler-specific compilation flags +# SC_FLAGS += compilation flags +# SC_CLASSPATH = location of user class files +# SC_SOURCEPATH = location of input source files +# SC_BOOTCLASSPATH = location of bootstrap class files +# SC_EXTDIRS = location of installed extensions +# SC_OUTPUTDIR = directory where to place generated class files +# SC_ENCODING = character encoding used by source files +# SC_SOURCE = version of source code +# SC_TARGET = version of target bytecode +# SC_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 SC_CLASSPATH with target LIBRARY, one may define the +# variable LIBRARY_SC_CLASSPATH +# +############################################################################## +# Examples +# +# Compile file "sources/scala/Predef.scala" +# +# make sc SC_FILES=sources/scala/Predef.scala +# +# +# Compile the whole runtime +# +# make sc target=LIBRARY +# +# +# A Makefile rule that compiles all modified files from the runtime +# +# .latest-library : $(LIBRARY_SC_FILES) +# @$(MAKE) sc target=LIBRARY LIBRARY_SC_FILES='$?' +# touch $@ +# +############################################################################## + +############################################################################## +# Defaults + +SC_COMPILER ?= SCALAC +CYGWIN_PATH ?= $(1) +CYGWIN_FILE ?= $(1) +SCALAC ?= socos + +############################################################################## +# Values + +sc_COMPILER = $(call SC_LOOKUP,SC_COMPILER) +sc_compiler = $(call SC_LOOKUP,$(sc_COMPILER)) +sc_compiler_flags = $(call SC_LOOKUP,$(sc_COMPILER)_FLAGS) +sc_FLAGS = $(call SC_LOOKUP,SC_FLAGS) +sc_CLASSPATH = $(call SC_LOOKUP,SC_CLASSPATH) +sc_SOURCEPATH = $(call SC_LOOKUP,SC_SOURCEPATH) +sc_BOOTCLASSPATH = $(call SC_LOOKUP,SC_BOOTCLASSPATH) +sc_EXTDIRS = $(call SC_LOOKUP,SC_EXTDIRS) +sc_OUTPUTDIR = $(call SC_LOOKUP,SC_OUTPUTDIR) +sc_ENCODING = $(call SC_LOOKUP,SC_ENCODING) +sc_SOURCE = $(call SC_LOOKUP,SC_SOURCE) +sc_TARGET = $(call SC_LOOKUP,SC_TARGET) +sc_FILES = $(call SC_LOOKUP,SC_FILES) + +############################################################################## +# Command + +sc += $(sc_compiler) +sc += $(sc_compiler_flags) +sc += $(sc_FLAGS) +sc += $(sc_CLASSPATH:%=-classpath $(call CYGWIN_PATH,%)) +sc += $(sc_SOURCEPATH:%=-sourcepath $(call CYGWIN_PATH,%)) +sc += $(sc_BOOTCLASSPATH:%=-bootclasspath $(call CYGWIN_PATH,%)) +sc += $(sc_EXTDIRS:%=-extdirs $(call CYGWIN_PATH,%)) +sc += $(sc_OUTPUTDIR:%=-d $(call CYGWIN_FILE,%)) +sc += $(sc_ENCODING:%=-encoding %) +sc += $(sc_SOURCE:%=-source %) +sc += $(sc_TARGET:%=-target %) +sc += $(sc_FILES:%=$(call CYGWIN_FILE,%)) + +############################################################################## +# Functions + +SC_LOOKUP = $(if $($(target)_$(1)),$($(target)_$(1)),$($(1))) + +############################################################################## +# Rules + +sc : + echo $(LIBRARY_SC_FILES) + @[ -d "$(sc_OUTPUTDIR)" ] || $(MKDIR) -p "$(sc_OUTPUTDIR)" + $(strip $(sc)) + +.PHONY : sc + +############################################################################## |