#!/usr/bin/make -f
#export DH_VERBOSE=1
CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)

%:
	dh $@ --with autotools_dev

override_dh_auto_configure:
	CFLAGS="$(CFLAGS) $(CPPFLAGS)" dh_auto_configure -- \
		--prefix=/usr \
		--bindir=/usr/games \
		--mandir='$${prefix}/share/man' \
		--with-prefsdir=/etc \
		--with-scoresdir=/var/games \
		--with-ncurses=/usr

override_dh_auto_clean:
	[ ! -f Makefile ] || $(MAKE) clean

override_dh_auto_install:
	$(MAKE) DESTDIR=$(CURDIR)/debian/freesweep install

override_dh_installchangelogs:
	dh_installchangelogs CHANGES

override_dh_fixperms:
	dh_fixperms
	chmod 2755 $(CURDIR)/debian/freesweep/usr/games/freesweep
	chown root:games $(CURDIR)/debian/freesweep/usr/games/freesweep
