#!/usr/bin/make -f
# This file is in the public domain.
# You may freely use, modify, distribute, and relicense it.

clean build build-indep build-arch install binary-indep binary-arch binary:
	dh $@
.PHONY: clean build install binary-indep binary-arch binary

override_dh_auto_clean:
	sh debian/autogen.sh
	test -e debian/changelog.upstream || { \
		echo >&2 see debian/README.source; \
		exit 1; \
	}
	rm -f radeontool.8; # from docbook-to-man
	rm -f radeontool avivotool radeonreg; # from cc
	rm -f *.o; # from cc
	rm -f *.tab.c; # from yacc
	rm -fr *.lo .libs _libs; # from libtool
	rm -f Makefile libtool; # from config.status
	rm -f config.status config.cache config.log; # from configure
	rm -f configure.lineno config.status.lineno config.lt; # from configure
	rm -fr configure autom4te.cache; # from autoconf
	rm -fr .deps; # from depcomp
	rm -f Makefile.in config.guess config.sub; # from automake
	rm -f depcomp install-sh ltmain.sh missing; # from automake
	rm -f aclocal.m4; # from aclocal
	rm -f CHANGES autogen.sh fix.sh lightwatch.pl; # not distributed

override_dh_auto_configure:
	autoreconf -is
	dh_auto_configure -- $(conf_opt)

override_dh_auto_build:
	dh_auto_build
	docbook-to-man debian/radeontool.sgml > radeontool.8

override_dh_installman:
	dh_installman radeontool.8

override_dh_installchangelogs:
	dh_installchangelogs debian/changelog.upstream

conf_opt = --bindir='$${exec_prefix}/sbin'
export DEB_CFLAGS_MAINT_PREPEND = -Wall
