#!/usr/bin/make -f

%:
	dh $@ \
		--buildsystem=cmake \
		--parallel \
		--dbg-package=colobot-dbg

override_dh_auto_configure:
ifneq (,$(findstring colobot-common-sounds, $(shell dh_listpackages)))
	# Make sure the data/music submodule is reacheable where it should
	[ -h data/music ] || (rmdir data/music; ln -s ../music data/music)
endif
	dh_auto_configure -- -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" \
	                     -DINSTALL_DOCS:BOOL=True \
	                     -DOPENAL_SOUND:BOOL=True

override_dh_auto_build:
	dh_auto_build -a
	dh_auto_build -i -- doc
	# obj-* is the default builddirectory in debhelper
	convert obj-$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)/desktop/32/colobot.png debian/colobot.xpm

override_dh_auto_clean:
	dh_auto_clean
	rm -f debian/colobot.xpm
	# Make sure the data/music submodule is reacheable where it should
	[ ! -h data/music ] || (rm -f data/music; mkdir data/music)
