#!/usr/bin/make -f
export DH_VERBOSE = 1
DEB_BUILD_OPTIONS += nodoc

%:
	dh $@

override_dh_auto_build:
	dh_auto_build
	# Regenerate repacked files
	cat tests/sa.sam | samtools view -Sb - > tests/sa.bam
	samtools index tests/sa.bam tests/sa.bam.bai
	cat debian/missing-sources/HG02002.sam | samtools view -Sb - > tests/HG02002.bam
	samtools index tests/HG02002.bam tests/HG02002.bam.bai
	tabix tests/test.vcf.gz
	bcftools index tests/test.bcf

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	nim c --nimcache:$(CURDIR)/tests/nimcache --mm:refc  -d:useSysAssert -d:useGcAssert --lineDir:on --debuginfo -r tests/all
endif

override_dh_auto_clean:
	dh_auto_clean
	# remnants from testing
	rm -f ____t.vcf t.gz ti.txt.gz ti.txt.gz.csi
	rm -f tests/run tests/HG02002.bam.csi tests/auxtest tests/newsample.vcf tests/outmissing.vcf tests/outv.vcf tests/outz.vcf tests/sample.fa.fai tests/all tests/htstest tests/bgzftest tests/bamtest
	rm -rf tests/nimcache
