#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS)
LDFLAGS += -Wl,--as-needed

CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS   = $(shell dpkg-buildflags --get CFLAGS)
CFLAGS  += -Wall

LINK     = $(CC) $(LDFLAGS)
CCX      = $(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS)

override_dh_installchangelogs:
	dh_installchangelogs CHANGELOG.GL

override_dh_auto_build:
	dh_auto_build -- CC="$(CCX)" LINK="$(LINK)"

override_dh_install:
	dh_install

	# Pixmaps
	install -m 0644 dat/*.png debian/glhack/usr/share/pixmaps/glhack/
	install -m 0644 debian/glhack.xpm debian/glhack/usr/share/pixmaps/glhack/

	chmod g+s debian/glhack/usr/lib/games/glhack/nhdat
	chmod g+s debian/glhack/usr/lib/games/glhack/glhack
	chmod g+s debian/glhack/usr/lib/games/glhack/recover_glhack

	ls -l debian/glhack/usr/lib/games/glhack/

	# Permissions
	#chmod 2664 debian/glhack/var/games/glhack/*
	#chmod 0775 debian/glhack/var/games/glhack
	#chmod 0775 debian/glhack/var/games/glhack/save

%:
	dh $@

# End of file
