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

DEBPKGNAME		:= $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')
DEB_HOST_MULTIARCH	?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
LIBDIR			:= $(CURDIR)/debian/$(DEBPKGNAME)/usr/lib/ # $(DEB_HOST_MULTIARCH)

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

%:
	dh $@ --with javahelper

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

get-orig-source:
	uscan --verbose --force-download --repack --compress xz
