#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

%:
	dh $@


override_dh_auto_configure:
	./configure --prefix=$(CURDIR)/debian/tmp/usr/ --disable-zlib --with-mpi=openmpi --disable-silent-rules

override_dh_auto_build:
	make OPTCFLAGS="$$(dpkg-buildflags --get CFLAGS)" OPTCXXXFLAGS="-OX `dpkg-buildflags --get CXXFLAGS`" OPTFFLAGS="`dpkg-buildflags --get FFLAGS`" OPTLDFLAGS="`dpkg-buildflags --get LDFLAGS`" V=1

override_dh_auto_install:
	dh_auto_install -v --destdir=/
	rm `find $(CURDIR)/debian/tmp -name '*.la'`

override_dh_installdocs:
	for f in otf2-config otf2-marker otf2-print otf2-snapshots salsa.mpi square; do \
		help2man --no-discard-stderr debian/tmp/usr/bin/$$f > debian/$$f.1; \
	done
	for f in scalasca scan; do \
		help2man --no-discard-stderr --help-option=-h debian/tmp/usr/bin/$$f > debian/$$f.1; \
	done
	dh_installdocs

override_dh_clean:
	rm -rf debian/*.1
	dh_clean
