#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk

GAP=/usr/bin/gap

default:
	@uscan --no-conf --dehs --report || true

%:
	dh $@

override_dh_auto_build:
	cat debian/makedoc.g | $(GAP) -A -q -T

testall.log:
	echo "\
		SetPackagePath(\"factint\",\".\"); \
		Read(\"tst/testall.g\"); \
		QUIT; \
		" | $(GAP) -A -q -T | tee $@

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test: testall.log
	grep '^#I  No errors detected' $<
endif

override_dh_installchangelogs:
	dh_installchangelogs --keep CHANGES

DEB_GAP_FACTINT_HDATADIR=$(CURDIR)/debian/gap-factint/usr/share/gap/pkg/factint/tables/brent
override_dh_compress:
	find $(DEB_GAP_FACTINT_HDATADIR) -type f -a -size +2k | xargs gzip --no-name --best
	dh_compress
