#!/usr/bin/make -f

# Copyright (C) Andreas Tille <tille@debian.org>
# License: GPL

DEBPKGNAME     := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')
exe=raxmlHPC

%:
	dh $@

override_dh_auto_clean:
	$(MAKE) -f Makefile.gcc clean

override_dh_auto_build:
	$(MAKE) -f Makefile.gcc

override_dh_auto_install:
	help2man --no-info --help-option="-h" --version-option="-v" \
	         --name="Randomized Axelerated Maximum Likelihood" \
	         $(CURDIR)/$(exe) > $(CURDIR)/debian/$(DEBPKGNAME)/usr/share/man/man1/$(exe).1

override_dh_installexamples:
	dh_installexamples
	# fix perl path in example scripts
	for pscript in `ls usefulScripts/*.pl` ; do \
	    sed 's?/usr/local/bin/perl?/usr/bin/perl?' $${pscript} > $(CURDIR)/debian/$(DEBPKGNAME)/usr/share/doc/$(DEBPKGNAME)/examples/`basename $${pscript}` ; \
	done

get-orig-source:
	mkdir -p ../tarballs
	uscan --verbose --force-download --repack --compress xz --destdir=../tarballs
