#!/usr/bin/make -f

.PHONY: clean
clean: doc/Makefile tests/Makefile
	$(MAKE) -C doc/ clean
	$(MAKE) -C tests/ clean
	dh_clean debian/build-stamp

.PHONY: build build-arch build-indep
build: build-indep
build-indep: debian/build-stamp
	
debian/build-stamp: doc/Makefile adequate
	$(MAKE) -B -C doc/
ifeq "$(filter nocheck,$(DEB_BUILD_OPTIONS))" ""
	./adequate coreutils 2>&1 | ( ! grep . )
endif
	touch $(@)

.PHONY: binary binary-arch binary-indep

binary: binary-indep
binary-indep: build-indep
	dh_testroot
	dh_prep
	dh_installdirs
	dh_install
	dh_installman doc/*.1
	dh_perl
	dh_installdocs
	dh_installchangelogs
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# vim:ts=4 sw=4 noet
