about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-09-11T13·28+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-09-11T13·28+0200
commit44e7e3bb9b36bca7023d207c51b7380b78ccfc4c (patch)
treecf127860c3f1dea147a4c16ed2348bbd22d6297b
parent075cfe3b97bf0e90577bb7e842ba467524fad0ef (diff)
Improved support for building JARs
-rw-r--r--jars.mk9
-rw-r--r--lib.mk5
2 files changed, 12 insertions, 2 deletions
diff --git a/jars.mk b/jars.mk
index 99470f37435b..186a81df1a94 100644
--- a/jars.mk
+++ b/jars.mk
@@ -1,4 +1,5 @@
 define build-jar
+
   $(1)_NAME ?= $(1)
 
   _d := $$(strip $$($(1)_DIR))
@@ -7,10 +8,14 @@ define build-jar
 
   $(1)_TMPDIR := $$(_d)/.$$($(1)_NAME).jar.tmp
 
-  $$($(1)_PATH): $$($(1)_SOURCES)
+  _jars := $$(foreach jar, $$($(1)_JARS), $$($$(jar)_PATH))
+
+  $$($(1)_PATH): $$($(1)_SOURCES) $$(_jars)
 	@rm -rf $$($(1)_TMPDIR)
 	@mkdir -p $$($(1)_TMPDIR)
-	$$(trace-javac) javac $(GLOBAL_JAVACFLAGS) $$($(1)_JAVACFLAGS) -d $$($(1)_TMPDIR) $$($(1)_SOURCES)
+	$$(trace-javac) javac $(GLOBAL_JAVACFLAGS) $$($(1)_JAVACFLAGS) -d $$($(1)_TMPDIR) \
+	  $$(foreach fn, $$($(1)_SOURCES), '$$(fn)') \
+	  -cp "$$(subst $$(space),,$$(foreach jar,$$($(1)_JARS),$$($$(jar)_PATH):))$$$$CLASSPATH"
 	$$(trace-jar) jar cf $$($(1)_PATH) -C $$($(1)_TMPDIR) .
 	@rm -rf $$($(1)_TMPDIR)
 
diff --git a/lib.mk b/lib.mk
index aa92d8d94304..16a43f45e26e 100644
--- a/lib.mk
+++ b/lib.mk
@@ -14,6 +14,11 @@ dist-files :=
 OS = $(shell uname -s)
 
 
+# Hack to define a literal space.
+space :=
+space +=
+
+
 # Default installation paths.
 prefix ?= /usr/local
 libdir ?= $(prefix)/lib