#!/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 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 \
                    --movedev "fml.h" /usr/include/ \
                    --movedev "bfc.h"  /usr/include/fml \
                    --movedev "htab.h" /usr/include/fml \
                    --movedev "kmer.h"  /usr/include/fml \
                    --movedev "internal.h" /usr/include/fml \
                    --movedev "khash.h" /usr/include/fml \
                    --movedev "kvec.h" /usr/include/fml \
                    --movedev "ksort.h" /usr/include/fml \
                    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
