Donnerstag, 14. November 2013

GNU Make wrapper for Ant.

The following is a GNU make wrapper for Apache Ant. Those targets, which must be implemented in GNU Make can be implemented in the Make file and all other targets are passed to Ant. And it is possible to mix different Ant and Make targets.
all:
 @ant -e jar

# The following prevents the execution of "cat" on systems, which do not
# support it.
_import:
 $(eval PACKAGE := $(shell cat PACKAGE))
 $(eval VERSION := $(shell cat VERSION))

DEVELOPMENT := 
PRODUCTION := 
BIN_JAR = build/jar/$(PACKAGE)-$(VERSION).jar

install: _import binjar
 scp $(BIN_JAR) $(PRODUCTION)/.
 cp $(BIN_JAR) $(DEVELOPMENT)/.

tag: _import
 $(eval TRUNC_URL := $(shell svn info --xml | xmllint --xpath '/info/entry/url/text()' -))
 svn -m "TAG: $(VERSION)" cp $(TRUNC_URL) $(subst trunk,tags/$(VERSION),$(TRUNC_URL))

# Pass all other targets to ant
%:
 @ant -e "$@"
In this case the Subversion tagging is not done in Ant. It is easier to do it in the Make file.

Keine Kommentare: