#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@

pkg=velvet

override_dh_auto_clean :
	dh_auto_clean
	rm -rf zlib

override_dh_auto_build :
	touch zlib # prevents the zlib in the ‘third-party’ folder to be built.
	dh_auto_build -- OPENMP=1 CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
	dh_auto_build -- color OPENMP=1 CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"

override_dh_install :
	mkdir -p $(CURDIR)/debian/$(pkg)/usr/share/man/man1/
	help2man --no-info --name="simple hashing program" \
	         $(CURDIR)/velveth > $(CURDIR)/debian/$(pkg)/usr/share/man/man1/velveth.1
	help2man --no-info --name="simple hashing program (colorspace version)" \
	         $(CURDIR)/velveth_de > $(CURDIR)/debian/$(pkg)/usr/share/man/man1/velveth_de.1
	help2man --no-info --version-option=" " \
	         --name="de Bruijn graph construction, error removal and repeat resolution" \
	         $(CURDIR)/velvetg > $(CURDIR)/debian/$(pkg)/usr/share/man/man1/velvetg.1
	help2man --no-info --version-option=" " \
	         --name="de Bruijn graph construction, error removal and repeat resolution (colorspace version)" \
	         $(CURDIR)/velvetg_de > $(CURDIR)/debian/$(pkg)/usr/share/man/man1/velvetg_de.1
	dh_install
	rm -rf $(CURDIR)/debian/$(pkg)/usr/share/velvet/contrib/MetaVelvet-v0.3.1/obj
	# remove extra copies of GPL
	find $(CURDIR)/debian -type f -name 'LICENSE*' -delete

#Prevent compression of user manual
override_dh_compress :
	dh_compress -X.pdf

override_dh_pysupport :
	#Not needed, Python scripts are just for examples

override_dh_builddeb:
	dh_builddeb -- -Z xz

get-orig-source:
	. debian/get-orig-source

