#!/usr/bin/make -f

export JAVA_HOME=/usr/lib/jvm/default-java
VERSION := \$(shell dpkg-parsechangelog | grep ^Version: | sed -r 's/^.*:\ (.*)-.*$$/\1/')

%:
	dh $@ --with javahelper

override_dh_auto_build:
	dh_auto_build
	ant -Dversion=$(VERSION) jar javadoc

override_dh_auto_install:
	dh_auto_install
#	mh_installjar -plibguice-java --set-version=$(VERSION) -l -v \
#
	mh_installjar -plibguice-java -l --usj-version=$(VERSION) \
		core/pom.xml build/dist/guice-$(VERSION).jar
	mh_installpoms -plibguice-java --set-version=$(VERSION)
	# ugly workaround until #640730 is fixed
	-find debian/libguice-java -type d -name '*-SNAPSHOT' -exec rm -fr {} \;

override_dh_auto_clean:
	dh_auto_clean
	mh_clean

override_dh_compress:
	dh_compress -X.java

get-orig-source:
	cd $(dir $(firstword $(MAKEFILE_LIST)))../ && \
	uscan --destdir $(CURDIR) --force-download --download-current-version
