#!/usr/bin/make -f

#export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

BUILD_FLAGS=--portaudio=true
BUILD_FLAGS+=INSTALLDIR=$(CURDIR)/debian/tmp/usr/share/games/ BINDIR=$(CURDIR)/debian/tmp/usr/games/
BUILD_FLAGS+=LINKFLAGS="$(shell dpkg-buildflags --get LDFLAGS)"
BUILD_FLAGS+=CXXFLAGS="$(shell dpkg-buildflags --get CPPFLAGS) $(shell dpkg-buildflags --get CXXFLAGS)"

%:
	dh $@

override_dh_auto_build:
	scons $(BUILD_FLAGS)

override_dh_auto_install:
	scons install $(BUILD_FLAGS)
	uudecode -o debian/patches/tutorial-part4.map.bspatch debian/patches/tutorial-part4.map.uuencode
	bspatch campaigns/tutorial-part4.map \
		debian/tmp/usr/share/games/glob2/campaigns/tutorial-part4.map \
		debian/patches/tutorial-part4.map.bspatch
	chmod 644 debian/tmp/usr/share/games/glob2/campaigns/Tutorial_Campaign.txt
