#!/usr/bin/make -f

CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)


export CPPFLAGS
export CFLAGS
export CXXFLAGS
export LDFLAGS

%:
	dh --buildsystem=cmake $@

override_dh_auto_configure:
	dh_auto_configure -- \
	-DDATADIR=share/games/vavoom \
	-DBINDIR=games \
	-DCMAKE_INSTALL_PREFIX=/usr \
	$(cmake_extra_args)

override_dh_installchangelogs:
	dh_installchangelogs docs/changes3.log

override_dh_install:
	install -d debian/vavoom/usr/lib/vavoom
	mv debian/vavoom/usr/games/vavoom.bin debian/vavoom/usr/lib/vavoom/
	mv debian/vavoom/usr/games/vavoom-dedicated.bin debian/vavoom/usr/lib/vavoom/
	install -d debian/vavoom/usr/share/applications
	mv debian/vavoom.desktop                 debian/vavoom/usr/share/applications/

#override_dh_link:
#	dh_link debian/vavoom/usr/share/man/man6/vavoom.6 debian/vavoom/usr/share/man/man6/vavoom-dedicated.6
#	ln -s debian/vavoom/usr/share/man/man6/vavoom.6 debian/vavoom/usr/share/man/man6/vavoom-dedicated.6
#	ls debian/vavoom/usr/share/man/man6
#	ls usr/share/man/man6
