#!/usr/bin/make -f

CONFIGURE_OPTIONS = --with-arpack=/usr/lib/$(DEB_HOST_MULTIARCH) --with-fftw3=/usr/lib/$(DEB_HOST_MULTIARCH) --with-readline=/usr/lib/$(DEB_HOST_MULTIARCH)

ifeq ($(shell test -e /usr/include/OpenMM.h && echo YES),YES)
	CONFIGURE_OPTIONS += --with-openmm=/usr/lib/$(DEB_HOST_MULTIARCH)
endif

%:
	dh $@

override_dh_auto_configure:
	./configure gnu $(CONFIGURE_OPTIONS)

override_dh_auto_test:
	dh_auto_test -- check unittest
	$(MAKE) -C test summary

override_dh_auto_clean:
	touch config.h external.config.h
	dh_auto_clean
	rm -rf bin

# Manpage generation is supposed to be run manually after the binary
# package has been built and installed on the system.
debian/cpptraj.1:
	help2man cpptraj --no-discard-stderr --no-info --name 'fast, parallelized molecular dynamics trajectory data analysis' > $@