#!/usr/bin/make -f

# export DH_OPTIONS

APKG = aspell-tl
MPKG = myspell-tl
MTMP = myspell-tmp

build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp:
	dh_testdir
	gzip -c --best < tl.cwl > tl.cwl.gz
	preunzip < tl.cwl > tl.dic.debian0
	( echo `cat tl.dic.debian0 | wc -l `; cat tl.dic.debian0 ) > tl_PH.dic
	mkdir -p $(MTMP)
	cp tl_PH.dic $(MTMP)/tl.dic
	cp tl_affix.dat $(MTMP)/tl.aff
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -f build-stamp tl.cwl.gz tl.dic.debian0 tl_PH.dic
	rm -rf $(MTMP)
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	installdeb-aspell   -p$(APKG) # This calls internally dh_installdebconf
	installdeb-myspell  -p$(MPKG) --srcdir=$(MTMP)
	installdeb-hunspell -p$(MPKG)

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installdirs
	dh_installdocs -A doc/Crawler.txt doc/NEWS
	dh_installchangelogs
	dh_install
	dh_installman
	dh_compress
	dh_fixperms
	dh_link
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch:

binary:	binary-indep

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