#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
# Modified for GAP by Bill Allombert 2003

build-indep-stamp:
	mkdir -p debian/gaproot/pkg
	ln -s ../../.. debian/gaproot/pkg/CTblLib
ifeq (,$(findstring notest,$(DEB_BUILD_OPTIONS)))
	gap -q -l 'debian/gaproot;/usr/share/gap' < tst/testinst.g | tee debian/gap.tst
	! grep "^########" debian/gap.tst
endif
	make -C doc && touch build-indep-stamp
build-indep: build-indep-stamp
build-arch:
build: build-indep

clean:
	dh_testdir
	dh_testroot
	make -C doc clean
	rm -f build-indep-stamp
	rm -rf debian/gaproot
	rm -f debian/gap.tst
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	dh_install *.g data dlnames gap3 gap4 usr/share/gap/pkg/ctbllib
	make -C doc install DESTDIR=../debian/gap-character-tables
	gzip --best --no-name -r debian/gap-character-tables/usr/share/gap/pkg/ctbllib/data
binary-arch: build-arch
binary-indep: build-indep install
	dh_testdir
	dh_testroot
	dh_installdocs README
	dh_installexamples
	dh_installchangelogs
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
