#!/usr/bin/make -f

DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

REPORT := /usr/share/doc/posixtestsuite/report.$(DEB_HOST_GNU_TYPE).log

build-indep:

# We need a stamp file to avoid running the test suite twice.
build-arch: build-arch-stamp
build-arch-stamp:
	dh_testdir

	$(MAKE)

	touch $@

build: build-indep build-arch

clean:
	dh_testdir
	dh_testroot

	$(MAKE) clean

	$(RM) *-stamp

	dh_clean

install-arch: build-arch
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	gzip -nc9 logfile >$(CURDIR)/debian/posixtestsuite/$(REPORT).gz

binary-indep:
	# Nothing to do.

binary-arch: install-arch
	dh_testdir
	dh_testroot
	dh_installdocs
#	dh_installexamples
	dh_installman
#	dh_installinfo
	dh_installchangelogs
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch

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