#!/usr/bin/make -f
# debian/rules for phylip using dh
# Andreas Tille <tille@debian.org>, GPL

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

include /usr/share/dpkg/default.mk

DEB_HOST_MULTIARCH	?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
LIBDIR			:= $(CURDIR)/debian/$(DEB_SOURCE)/usr/lib/ # $(DEB_HOST_MULTIARCH)

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

%:
	dh $@ --with javahelper --no-parallel

override_dh_auto_build:
	dh_auto_build --sourcedirectory=src --buildsystem=makefile -- -f Makefile.unx all
	cp debian/build.xml build.xml
	ant

override_dh_auto_install:
	dh_auto_install --sourcedirectory=src --buildsystem=makefile -- -f Makefile.unx install DATADIR=../fonts
#	mkdir -p $(LIBDIR)
#	cp -a src/lib*.so* $(LIBDIR)

override_dh_installexamples:
	dh_installexamples
	find debian -type f -name "*.txt" -exec chmod a-x \{\} \;

override_dh_auto_clean:
	dh_auto_clean --sourcedirectory=src --buildsystem=makefile -- -f Makefile.unx clean
	rm -fr exe/* fonts/ src/*.so*
	if [ -e build.xml ] ; then \
	    ant clean ; \
	    rm -rf dist build.xml ; \
	fi