#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DEBVERS        := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')
VERSION        := $(shell echo '$(DEBVERS)' | sed -e 's/^[0-9]*://' -e 's/-.*//')
CXXFLAGS := -std=gnu++98
export CXXFLAGS

%:
	dh $@

override_dh_auto_test:
	dh_auto_test
	./unit_tests

override_dh_auto_build:
	dh_auto_build
	help2man --no-discard-stderr --no-info --version-string="${VERSION}" \
		--name "scalable nucleotide alignment program" \
		--help-option=" " ./snap-aligner > debian/snap-aligner.1
	for option in index single paired; do help2man \
		--no-discard-stderr --no-info --version-string="${VERSION}" \
		--include=debian/snap-aligner-$${option}-man-include \
		--help-option=" " "./snap-aligner $${option}" > \
		debian/snap-aligner-$${option}.1; done
	help2man --no-discard-stderr --no-info --version-string="${VERSION}" \
		--name "scalable nucleotide alignment program" \
		--help-option=" " ./SNAPCommand > debian/SNAPCommand.1

override_dh_auto_clean:
	dh_auto_clean
	rm -f debian/*.1
	rm -f */*.d */*/*.d
