#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS  = hardenning=+all
export DEB_LDFLGAS_MAINT_APPEND = -Wl,--as-needed

# package name
PKGNAME=$(strip $(shell head -n1 debian/changelog | cut -d' ' -f1))

# current Debian package version
DEBVER=$(strip $(shell head -n1 debian/changelog | cut -d' ' -f2 | tr -d '()'))

# current upstream version (remove any epoch and Debian release number)
UPVER=$(shell echo $(DEBVER) | sed -e 's/-[^-]*$$//' -e 's/^[^:]*://')

../$(PKGNAME)_$(UPVER).orig.tar.gz:
	./debian/get-orig-source --upstream-version $(UPVER) $@

get-orig-source: ../$(PKGNAME)_$(UPVER).orig.tar.gz

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		--with-momentum=GEV \
		--with-length=MM \
		--libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)

override_dh_auto_install:
	dh_auto_install
	rm -f debian/tmp/usr/share/HepMC/examples/pythia8/config.sh
	rm -f debian/tmp/usr/share/HepMC/examples/pythia8/config.csh
	rm -f debian/tmp/usr/share/HepMC/examples/pythia8/README

override_dh_auto_build-arch:
	dh_auto_build --parallel
	
override_dh_auto_build-indep:
	cd doc; ./buildDoc.sh

override_dh_auto_test-arch:
	dh_auto_test --no-parallel -- -C test check-TESTS

override_dh_auto_test-indep:
