#!/usr/bin/make -f

include /usr/share/dpkg/default.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow
export DEB_CFLAGS_MAINT_APPEND += -DSIMDE_ENABLE_OPENMP -fopenmp-simd -O3
export DEB_CXXFLAGS_MAINT_APPEND += -DSIMDE_ENABLE_OPENMP -fopenmp-simd -O3
ifneq (,$(filter $(DEB_HOST_ARCH), armel armhf m68k mipsel powerpc sh4))
  export LDLIBS=-latomic
endif

%:
	dh $@

override_dh_auto_clean:
	dh_auto_clean
	rm -f fml-asm.1

override_dh_auto_install:
	ln -s libfml.so.* libfml.so
	d-shlibmove --commit \
                    --multiarch \
                    --devunversioned \
                    libfml.so

override_dh_installman:
	help2man --version-string='0.1' \
          -n 'assemble Illumina short reads in small regions' \
          -N --no-discard-stderr -h '' ./fml-asm > fml-asm.1
	dh_installman

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	./fml-asm test/MT-simu.fq.gz > MT.fq
	test "$$(wc -l < MT.fq)" = "4"
	rm -f MT.fq
endif
