#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export JAVA_HOME=/usr/lib/jvm/default-java

FULLVER := $(shell dpkg-parsechangelog | grep ^Version | cut -d\  -f2 | cut -d- -f1 )
UPVER   := $(shell echo $(FULLVER) | cut -d~ -f1 )
SVNREV  := $(shell echo $(FULLVER) | awk -F"~svn" '{print $$2}' )

override_dh_auto_build:
	ant compile
	ant jar
	mv gettext-ant-tasks.jar gettext-ant-tasks-$(UPVER).jar

override_dh_auto_clean:
	dh_auto_clean
	rm -rf target *.jar

get-orig-source:
	svn -r $(SVNREV) checkout \
		http://gettext-commons.googlecode.com/svn/gettext-ant-tasks/trunk \
		gettext-ant-tasks
	find gettext-ant-tasks -type d -name ".svn" | xargs rm -rf
	tar zcf gettext-ant-tasks_$(FULLVER).orig.tar.gz \
		gettext-ant-tasks/
	rm -rf gettext-ant-tasks/

%:
	dh --with javahelper $@
