#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS
BASEDIR=`pwd`/debian/aspell-ml

configure: configure-stamp
configure-stamp:
	dh_testdir
	./configure
	touch $@

build: configure-stamp build-stamp
build-stamp:
	dh_testdir
	$(MAKE)
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	[ ! -f Makefile ] || $(MAKE) distclean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	$(MAKE) DESTDIR=$(BASEDIR) install
	gzip -9c ml.cwl > $(BASEDIR)/usr/share/aspell/ml.cwl.gz
	touch $(BASEDIR)/var/lib/aspell/ml.compat
	touch $(BASEDIR)/var/lib/aspell/ml.rws
	ln -sf /var/lib/aspell/ml.rws $(BASEDIR)/usr/lib/aspell/ml.rws
	echo ml >> $(BASEDIR)/usr/share/aspell/ml.contents
	installdeb-aspell

binary-indep: DH_OPTIONS=-i
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installchangelogs
	dh_installinfo
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch: build install

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