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 TOUCH = touch artifactIds := $(patsubst archive/%.mf,%,$(wildcard archive/*.mf)) 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) 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 || \ { $(RM) -r $@; $(FAIL); } $(TOUCH) $@ test/lib: $(MKDIRS) $@ install-base = $(DESTDIR)$(MAVEN_LOCAL_REPO)/$(subst .,/,$(groupId))/$(artifactId)/$(version)/$(artifactId)-$(version) install-jars = $(foreach artifactId,$(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-jars),$(eval $(target): output/dist/lib/$(notdir $(target)) ; $$(INSTALL) -Dm644 $$< $$@)) $(foreach target,$(install-poms),$(eval $(target): output/dist/lib/$(patsubst %.pom,%.xml,$(notdir $(target))) ; $$(INSTALL) -Dm644 $$< $$@)) $(addprefix output/dist/lib/,$(patsubst %.pom,%.xml,$(notdir $(install-targets)))): output $(EXISTS) $@ $(TOUCH) $@ clean: PHONY $(RM) -r output .PHONY: PHONY .DELETE_ON_ERROR: .SECONDARY: