Improved support for building JARs
This commit is contained in:
parent
075cfe3b97
commit
44e7e3bb9b
2 changed files with 12 additions and 2 deletions
9
jars.mk
9
jars.mk
|
@ -1,4 +1,5 @@
|
||||||
define build-jar
|
define build-jar
|
||||||
|
|
||||||
$(1)_NAME ?= $(1)
|
$(1)_NAME ?= $(1)
|
||||||
|
|
||||||
_d := $$(strip $$($(1)_DIR))
|
_d := $$(strip $$($(1)_DIR))
|
||||||
|
@ -7,10 +8,14 @@ define build-jar
|
||||||
|
|
||||||
$(1)_TMPDIR := $$(_d)/.$$($(1)_NAME).jar.tmp
|
$(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)
|
@rm -rf $$($(1)_TMPDIR)
|
||||||
@mkdir -p $$($(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) .
|
$$(trace-jar) jar cf $$($(1)_PATH) -C $$($(1)_TMPDIR) .
|
||||||
@rm -rf $$($(1)_TMPDIR)
|
@rm -rf $$($(1)_TMPDIR)
|
||||||
|
|
||||||
|
|
5
lib.mk
5
lib.mk
|
@ -14,6 +14,11 @@ dist-files :=
|
||||||
OS = $(shell uname -s)
|
OS = $(shell uname -s)
|
||||||
|
|
||||||
|
|
||||||
|
# Hack to define a literal space.
|
||||||
|
space :=
|
||||||
|
space +=
|
||||||
|
|
||||||
|
|
||||||
# Default installation paths.
|
# Default installation paths.
|
||||||
prefix ?= /usr/local
|
prefix ?= /usr/local
|
||||||
libdir ?= $(prefix)/lib
|
libdir ?= $(prefix)/lib
|
||||||
|
|
Loading…
Reference in a new issue