#!/usr/bin/make -f
# -*- makefile -*-

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
export CCFLAGS:=$(shell dpkg-buildflags --get CFLAGS) -DSTRATAGUS_LIB_PATH=\"/usr/share/games/boswars\"
export LINKFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)

%:
	dh $@

override_dh_auto_build:
	scons CPPFLAGS='$(CPPFLAGS)' CCFLAGS='$(CCFLAGS)' LINKFLAGS='$(LINKFLAGS)'

override_dh_auto_install:

override_dh_install:
	# Copy (and rename) an icon to be used as desktop file
	cp units/tank/ico_tank.png debian/boswars.png
	# rename binary
	mv build/boswars-release build/boswars
	# Default action
	dh_install
	# Remove unneeded files.
	for i in genpot.sh makesame.py updatepo.sh ; do \
		rm -f debian/boswars-data/usr/share/games/boswars/languages/$$i ; \
	done
	rm -f debian/boswars/usr/share/doc/boswars/html/README-SDL.txt
	rm -f debian/boswars/usr/share/doc/boswars/html/*copyright*

clean:
	scons -c
	# Additional icon (see build-indep-stamp)
	rm  -f debian/boswars.png
	# Scons is stupid and leaves them behind no matter what.
	rm  -f .sconsign.dblite
	rm -rf .sconf_temp
	rm  -f build_conf_cache.py build_options.py config.log

