DESTDIR ?= MAVEN_LOCAL_REPO ?= ~/.m2 ANT = ant EXISTS = test -e FIND = find INSTALL = install RM = rm -f TOUCH = touch XMLSTARLET = xml artifactId := $(shell $(XMLSTARLET) sel -T -t -c /_:project/_:artifactId -n pom.xml) version := $(shell $(XMLSTARLET) sel -T -t -c /_:project/_:version -n pom.xml) groupId := $(shell $(XMLSTARLET) sel -T -t -c /_:project/_:groupId -n pom.xml) all: PHONY javassist.jar javassist.jar: $(shell $(FIND) src/main) build.xml $(ANT) jar $(EXISTS) '$@' $(TOUCH) '$@' install-base = $(DESTDIR)$(MAVEN_LOCAL_REPO)/$(subst .,/,$(groupId))/$(artifactId)/$(version)/$(artifactId)-$(version) install: PHONY $(install-base).jar $(install-base).pom $(install-base).jar: javassist.jar $(INSTALL) -Dm644 $< $@ $(install-base).pom: pom.xml $(INSTALL) -Dm644 $< $@ clean: PHONY $(RM) -r target javassist.jar .PHONY: PHONY .DELETE_ON_ERROR: .SECONDARY: