summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2014-07-20 23:15:52 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2014-07-20 23:15:52 -0400
commit95492ebd7240cacf1cf8305414f10462707a7284 (patch)
treebe0b02817dcc6dd032da7725a7e54ad401a9be48 /rules
parent97aa93f3db2fd41ed667a502f5586b2e5b39631b (diff)
Get all versions of ASM to build.
Diffstat (limited to 'rules')
-rw-r--r--rules/asm2/Makefile33
-rw-r--r--rules/asm2/delete.list1
-rw-r--r--rules/bnd/Makefile51
3 files changed, 74 insertions, 11 deletions
diff --git a/rules/asm2/Makefile b/rules/asm2/Makefile
index 156651e..2024107 100644
--- a/rules/asm2/Makefile
+++ b/rules/asm2/Makefile
@@ -1,16 +1,17 @@
DESTDIR ?=
MAVEN_LOCAL_REPO ?= ~/.m2
-ANT = ant
-EXISTS = test -e
-FAIL = exit 1
-FIND = find
+ANT = ant
+EXISTS = test -e
+FAIL = exit 1
+FIND = find
INSTALL = install
-MKDIRS = mkdir -p
-RM = rm -f
-SED = sed
+MKDIRS = mkdir -p
+RM = rm -f
+SED = sed
SYMLINK = ln -sf
-TOUCH = touch
+TOUCH = touch
+ECHO = echo
artifactIds := $(patsubst archive/%.xml,%,$(wildcard archive/asm*.xml))
version := $(shell $(SED) -n 's/^product\.version\s\s*//p' build.properties)
@@ -18,12 +19,15 @@ groupId := asm
findjar = $(firstword $(foreach path,$(subst :, ,$(CLASSPATH)),$(if $(findstring $1,$(path)),$(path))) /notfound.jar)
ow_util_ant_tasks_jar = $(call findjar,ow_util_ant_tasks)
+bnd_jar = $(call findjar,biz.aQute.bnd)
all: PHONY output
-output: $(shell $(FIND) src) | test/lib
- $(SED) -i -e '/^objectweb.ant.tasks.path/d' -e '$$aobjectweb.ant.tasks.path $(ow_util_ant_tasks_jar)' build.properties && \
- $(ANT) dist && \
+output: $(shell $(FIND) src) .classpath | test/lib config/biz.aQute.bnd.jar
+ $(RM) -r $@
+ $(SED) -i '/^objectweb.ant.tasks.path/d' build.properties && \
+ $(SED) -i '$$aobjectweb.ant.tasks.path $(ow_util_ant_tasks_jar)' build.properties && \
+ $(ANT) jar && \
( cd output/dist/lib && $(SYMLINK) all/* . ) || \
{ $(RM) -r $@; $(FAIL); }
$(TOUCH) $@
@@ -31,6 +35,13 @@ output: $(shell $(FIND) src) | test/lib
test/lib:
$(MKDIRS) $@
+config/biz.aQute.bnd.jar:
+ $(MKDIRS) $(@D)
+ $(SYMLINK) $(bnd_jar) $@
+
+.classpath:
+ { $(ECHO) '<?xml version="1.0" encoding="UTF-8"?>'; $(ECHO) '<classpath></classpath>'; } > $@
+
install-base = $(DESTDIR)$(MAVEN_LOCAL_REPO)/$(subst .,/,$(groupId))/$(artifactId)/$(version)/$(artifactId)-$(version)
install-jars = $(foreach artifactId,$(filter-out %-parent,$(artifactIds)),$(install-base).jar)
install-poms = $(foreach artifactId, $(artifactIds) ,$(install-base).pom)
diff --git a/rules/asm2/delete.list b/rules/asm2/delete.list
new file mode 100644
index 0000000..cddd2a3
--- /dev/null
+++ b/rules/asm2/delete.list
@@ -0,0 +1 @@
+.classpath
diff --git a/rules/bnd/Makefile b/rules/bnd/Makefile
new file mode 100644
index 0000000..60eb1ca
--- /dev/null
+++ b/rules/bnd/Makefile
@@ -0,0 +1,51 @@
+# Install paths
+DESTDIR ?=
+JAR_DIR ?= /usr/share/java
+
+# Utilities
+ECHO = echo
+FAIL = exit 1
+FIND = find
+INSTALL = install
+JAR = jar
+JAVAC = javac
+MKDIRS = mkdir -p
+RM = rm -f
+SED = sed
+TOUCH = touch
+RSYNC = rsync
+
+dep_dir = $1 $(shell $(FIND) $1 2>/dev/null)
+dirs2jars = $(foreach dir,$1,$(dir)/generated/$(dir).jar)
+deps2classpath = $(shell $(ECHO) $(abspath $(filter %.jar,$1)) $(CLASSPATH) | $(SED) 'y/ /:/')
+
+subdirs := aQute.libg biz.aQute.bndlib biz.aQute.bnd
+
+all: PHONY build
+build: PHONY $(dirs2jars,$(subdirs))
+install: PHONY $(foreach d,$(subdirs),$(DESTDIR)$(JAR_DIR)/bnd/$d.jar)
+clean: PHONY
+ $(RM) -r -- $(addsuffix /bin,$(subdirs)) $(addsuffix /generated,$(subdirs))
+
+biz.aQute.bnd/bin : $(call dirs2jars,aQute.libg biz.aQute.bndlib)
+biz.aQute.bndlib/bin : $(call dirs2jars,aQute.libg )
+
+define recurse-rule
+$1/bin: $$(call dep_dir,$1/src)
+ $(RM) -r $$@
+ $(MKDIRS) $$@
+ CLASSPATH='$$(call deps2classpath,$$^)' $(JAVAC) -d $$@ $$(filter %.java,$$^) || { $(RM) -r $$@; $(FAIL); }
+ $(RSYNC) -r --exclude='*.java' $1/src/ $1/bin || { $(RM) -r $$@; $(FAIL); }
+ $(TOUCH) $$@
+
+$1/generated/$1.jar: $1/bin
+ $(MKDIRS) $$(@D)
+ $(JAR) -cf $$@ -C $$< .
+
+$(DESTDIR)$(JAR_DIR)/bnd/$1.jar: $1/generated/$1.jar
+ $(INSTALL) -Dm644 $$< $$@
+endef
+$(foreach subdir,$(subdirs),$(eval $(call recurse-rule,$(subdir))))
+
+.PHONY: PHONY FORCE
+.DELETE_ON_ERROR: