#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_CFLAGS_MAINT_APPEND += -std=gnu89 -fcommon -Wno-pointer-to-int-cast -Wno-error=old-style-definition -fno-builtin -Wno-implicit-function-declaration
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

%:
	dh $@

override_dh_autoreconf:
	ln -s /usr/share/gettext/config.rpath .
	dh_autoreconf

override_dh_auto_build:
	RESOLUTION=RES1024 $(MAKE) CFLAGS="$(CFLAGS)"

override_dh_auto_clean:
	dh_auto_clean
	rm -f config.rpath

override_dh_install:
	dh_install
	$(MAKE) install DESTDIR=$(CURDIR)/debian/spellcast

# Override dh_fixperms to set specific game directory permissions
override_dh_fixperms:
	dh_fixperms
	# Set the directory to root:games and 2775 (setgid) to allow
	# log files
	# chgrp -R games $(CURDIR)/debian/spellcast/var/games/spellcast
	# chmod g+rws $(CURDIR)/debian/spellcast/var/games/spellcast
