Support specifying a JAR manifest

This commit is contained in:
Eelco Dolstra 2014-09-11 15:47:31 +02:00
parent 44e7e3bb9b
commit 9648222ef0
2 changed files with 12 additions and 1 deletions

View file

@ -16,7 +16,7 @@ define build-jar
$$(trace-javac) javac $(GLOBAL_JAVACFLAGS) $$($(1)_JAVACFLAGS) -d $$($(1)_TMPDIR) \ $$(trace-javac) javac $(GLOBAL_JAVACFLAGS) $$($(1)_JAVACFLAGS) -d $$($(1)_TMPDIR) \
$$(foreach fn, $$($(1)_SOURCES), '$$(fn)') \ $$(foreach fn, $$($(1)_SOURCES), '$$(fn)') \
-cp "$$(subst $$(space),,$$(foreach jar,$$($(1)_JARS),$$($$(jar)_PATH):))$$$$CLASSPATH" -cp "$$(subst $$(space),,$$(foreach jar,$$($(1)_JARS),$$($$(jar)_PATH):))$$$$CLASSPATH"
$$(trace-jar) jar cf $$($(1)_PATH) -C $$($(1)_TMPDIR) . $$(trace-jar) jar cfm $$($(1)_PATH) <(echo -e '$$(subst $$(newline),\n,$$($(1)_MANIFEST))') -C $$($(1)_TMPDIR) .
@rm -rf $$($(1)_TMPDIR) @rm -rf $$($(1)_TMPDIR)
$(1)_INSTALL_DIR ?= $$(libdir)/java $(1)_INSTALL_DIR ?= $$(libdir)/java

11
lib.mk
View file

@ -14,11 +14,22 @@ dist-files :=
OS = $(shell uname -s) OS = $(shell uname -s)
# Use bash (required for process substitution in the JAR function).
SHELL = bash
# Hack to define a literal space. # Hack to define a literal space.
space := space :=
space += space +=
# Hack to define a literal newline.
define newline
endef
# Default installation paths. # Default installation paths.
prefix ?= /usr/local prefix ?= /usr/local
libdir ?= $(prefix)/lib libdir ?= $(prefix)/lib