#!/usr/bin/make -f

build: clean
	./configure $(CONF_OPTS)
	$(MAKE) clean all && touch build

clean:
	dh_testdir
	dh_clean
	rm -rf debian/tmp build
#	rm -f debian/postinst debian/postrm debian/`dh_listpackages`.modules
	rm -f debian/postinst debian/postrm
	-$(MAKE) proper

binary-indep:

binary-arch: build
	$(MAKE) ROOTDIR=$(CURDIR)/debian/tmp install
#	cp autoload.links debian/postinst
	cp autoload debian/postinst
#	enables support of multiple kernels
	echo '#DEBHELPER#' >> debian/postinst
#	cp cleanup.links debian/postrm
	cp cleanup debian/postrm
	echo '#DEBHELPER#' >> debian/postrm
#	cp debian/etc_devfs_conf.d_ltmodem debian/tmp/etc/devfs/conf.d/ltmodem
#	Now done within postinst, to enable support of  multiple kernels
	dh_testdir
	dh_testroot
	dh_installdocs  DOCs/ utils/
	dh_install
	dh_fixperms

#	mv debian/modules debian/`dh_listpackages`.modules
	dh_installmodules

	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
