summaryrefslogtreecommitdiff
path: root/support/make/jar.mk
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-03-17 08:35:26 +0000
committerpaltherr <paltherr@epfl.ch>2003-03-17 08:35:26 +0000
commit82cd3d4d235aedd52d230d912a001cb089f30686 (patch)
tree67633010b86f5920c9742ad9960de94161611682 /support/make/jar.mk
parentc9d34467cd7788c611aa15d63e4a50d01a03790b (diff)
downloadscala-82cd3d4d235aedd52d230d912a001cb089f30686.tar.gz
scala-82cd3d4d235aedd52d230d912a001cb089f30686.tar.bz2
scala-82cd3d4d235aedd52d230d912a001cb089f30686.zip
- Added jar.mk
Diffstat (limited to 'support/make/jar.mk')
-rw-r--r--support/make/jar.mk78
1 files changed, 78 insertions, 0 deletions
diff --git a/support/make/jar.mk b/support/make/jar.mk
new file mode 100644
index 0000000000..7fadaaa3ef
--- /dev/null
+++ b/support/make/jar.mk
@@ -0,0 +1,78 @@
+############################################################-*-Makefile-*-####
+# JAR - Build Java Archive
+##############################################################################
+# $Id$
+
+##############################################################################
+# Usage
+#
+# make jc [target=<target>] {<VARIABLE>=<value>}
+#
+##############################################################################
+# Variables
+#
+# JAR = archive command
+# JAR_FLAGS += archive flags
+# JAR_ARCHIVE = archive file
+# JAR_MANIFEST = manifest file
+# JAR_INPUTDIR = directory containing the files to archive
+# JAR_FILES += paths (relative to INPUTDIR) of the files to archive
+#
+# 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 JAR_ARCHIVE with target PROJECT, one may define the
+# variable PROJECT_JAR_ARCHIVE
+#
+##############################################################################
+# Examples
+#
+# Build the PROJECT java archive
+#
+# make jar target=PROJECT
+#
+#
+# Build a java archive containing all files in ./classes
+#
+# make jar JAR_ARCHIVE=test.jar JAR_INPUTDIR=./classes JAR_FILES=.
+#
+##############################################################################
+
+##############################################################################
+# Defaults
+
+JAR ?= jar
+
+##############################################################################
+# Values
+
+jar = $(call JAR_LOOKUP,JAR)
+jar_FLAGS = $(call JAR_LOOKUP,JAR_FLAGS)
+jar_ARCHIVE = $(call JAR_LOOKUP,JAR_ARCHIVE)
+jar_MANIFEST = $(call JAR_LOOKUP,JAR_MANIFEST)
+jar_INPUTDIR = $(call JAR_LOOKUP,JAR_INPUTDIR)
+jar_FILES = $(call JAR_LOOKUP,JAR_FILES)
+
+##############################################################################
+# Command
+
+jar += c$(jar_FLAGS)f$(jar_MANIFEST:%=m)
+jar += $(jar_ARCHIVE)
+jar += $(jar_MANIFEST)
+jar += $(jar_INPUTDIR:%=-C %)
+jar += $(jar_FILES)
+
+##############################################################################
+# Functions
+
+JAR_LOOKUP = $(if $($(target)_$(1)),$($(target)_$(1)),$($(1)))
+
+##############################################################################
+# Rules
+
+jar:
+ $(strip $(jar))
+
+.PHONY : jar
+
+##############################################################################