#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules file for beast-mcmc
# Andreas Tille <tille@debian.org>
# GPL

#export DH_VERBOSE=1

export LC_ALL=C.UTF-8

JAVA_HOME  := /usr/lib/jvm/default-java
ANT_HOME   := /usr/share/ant
ANT_BIN    := $(ANT_HOME)/bin/ant

# The Debian version is 1.<upstream-major>.<upstream-minor>.<upstream-patch>
# (see debian/watch), while upstream's build system expects just the upstream
# version, e.g. 1.10.6.0+dfsg-1 -> 10.6.0.
UPSTREAM_VERSION := $(shell dpkg-parsechangelog -SVersion | \
	sed -e 's/^1\.//' -e 's/+dfsg.*//' -e 's/-[^-]*$$//')

%:
	dh $@ --with javahelper

override_dh_auto_clean:
	rm -f src/revision.txt src/version.txt
	ant clean

override_dh_auto_build:
	ant -Dversion=$(UPSTREAM_VERSION) dist

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	#####################################################################
	## Run test suite                                                  ##
	## --------------                                                  ##
	## While this test suite runs quite a bit of time (about 30min) it ##
	## is recommended to be run at least once per new version upload   ##
	#####################################################################
	#
	# $(ANT_BIN) -Dversion=$(UPSTREAM_VERSION) junit
endif
