DESTDIR ?= MAVEN_LOCAL_REPO ?= ~/.m2 ANT = ant EXISTS = test -e FAIL = exit 1 FIND = find INSTALL = install MKDIRS = mkdir -p RM = rm -f SED = sed SYMLINK = ln -sf TOUCH = touch ECHO = echo artifactIds := $(patsubst archive/%.xml,%,$(wildcard archive/asm*.xml)) version := $(shell $(SED) -n 's/^product\.version\s\s*//p' build.properties) 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) .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) $@ test/lib: $(MKDIRS) $@ config/biz.aQute.bnd.jar: $(MKDIRS) $(@D) $(SYMLINK) $(bnd_jar) $@ .classpath: { $(ECHO) ''; $(ECHO) ''; } > $@ 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) install-targets = $(install-jars) $(install-poms) install: PHONY $(install-targets) $(foreach target,$(install-targets),$(eval $(target): output/dist/lib/$(notdir $(target)) ; $$(INSTALL) -Dm644 $$< $$@)) $(addprefix output/dist/lib/,$(notdir $(install-targets))): output $(EXISTS) $@ $(TOUCH) $@ clean: PHONY $(RM) -r output .PHONY: PHONY .DELETE_ON_ERROR: .SECONDARY: