DESTDIR ?= MAVEN_LOCAL_REPO ?= ~/.m2 ANT = ant EXISTS = test -e FAIL = exit 1 FIND = find INSTALL = install RM = rm -f TOUCH = touch artifactIds = jdom jdom-contrib version = 1.1.3 groupId = org.jdom all: PHONY dist-$(version) dist-$(version): $(shell $(FIND) core contrib test -mindepth 1 \( -name build -o -name tmp \) -prune -o -print) $(ANT) -Dgpg=echo -Dversion=$(version) maven || { $(RM) -r $@ */build; $(FAIL); } $(TOUCH) $@ install-dir = $(DESTDIR)$(MAVEN_LOCAL_REPO)/$(subst .,/,$(groupId))/$(artifactId)/$(version) install-targets = $(foreach artifactId,$(artifactIds),$(addprefix $(install-dir)/$(artifactId)-$(version),.pom .jar -sources.jar -javadoc.jar)) install: PHONY $(install-targets) $(foreach target,$(install-targets),$(eval $(target): dist-$$(version)/$(notdir $(target)) ; $$(INSTALL) -Dm644 $$< $$@)) $(addprefix dist-$(version)/,$(notdir $(install-targets))): dist-$(version) $(EXISTS) $@ $(TOUCH) $@ clean: PHONY $(RM) -r dist-$(version) */build .PHONY: PHONY .DELETE_ON_ERROR: .SECONDARY: