#!/usr/bin/make -f
#export DH_VERBOSE=1


build: build-stamp
build-stamp:
	dh_testdir
	touch build-stamp
	# Builds QuakeC and the uge data.zip archive. In case of emergency, i.e. if
	# Nexuiz complains about wrong cvar checksums also call the update-cvarcount
	# target, but be careful: It will modify in-tree files!
	make -C data pk3here
	mkdir -p tmp/sound
	cp -r data/sound/cdtracks tmp/sound
	cd tmp && 7za a -tzip -mx=0 music.pk3 sound
	# Same thing for the textures
	cd data && 7za a -tzip -mx=9 textures.pk3 textures
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	$(MAKE) -C data clean
	rm -f build-stamp configure-stamp
	rm -rf debian/tmp tmp
	rm -f data/data.pk3 \
		data/textures.pk3
	rm -f data/qcsrc/menu/fteqcc.log data/qcsrc/server/fteqcc.log \
		data/qcsrc/client/fteqcc.log
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	dh_install
	dh_installexamples

binary-arch: build install
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installdebconf	
	dh_installdocs
	dh_installchangelogs 
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
