#!/usr/bin/make -f

%:
	dh $@ --with autoreconf

override_dh_auto_configure:
	# xblast-tnt-mini
	dh_auto_configure --builddirectory=build_xblast-tnt-mini -- --with-x --disable-nls --enable-sound \
		--with-otherdatadir=/usr/share/games/xblast-tnt \
		CFLAGS="$(CFLAGS) -DXBLAST_SOUND_SERVER=\"\\\"/usr/lib/games/$(PKG1)/xbsndsrv\\\"\"" \
		--enable-mini --disable-SMPF
	# xblast-tnt-smpf
	dh_auto_configure --builddirectory=build_xblast-tnt-smpf -- --with-x --disable-nls --enable-sound \
		--with-otherdatadir=/usr/share/games/xblast-tnt \
		CFLAGS="$(CFLAGS) -DXBLAST_SOUND_SERVER=\"\\\"/usr/lib/games/$(PKG1)/xbsndsrv\\\"\"" \
		--disable-mini --enable-SMPF
	# regular binaries
	dh_auto_configure --builddirectory=build_xblast-tnt -- --with-x --disable-nls --enable-sound \
		--with-otherdatadir=/usr/share/games/xblast-tnt \
		CFLAGS="$(CFLAGS) -DXBLAST_SOUND_SERVER=\"\\\"/usr/lib/games/$(PKG1)/xbsndsrv\\\"\"" \
		--disable-mini --disable-SMPF

override_dh_auto_build:
	# mini binaries
	dh_auto_build --builddirectory=build_xblast-tnt-mini
	dh_auto_build --builddirectory=build_xblast-tnt-smpf
	dh_auto_build --builddirectory=build_xblast-tnt


override_dh_auto_clean:
	dh_auto_clean --builddirectory=build_xblast-tnt-mini
	dh_auto_clean --builddirectory=build_xblast-tnt-smpf
	dh_auto_clean --builddirectory=build_xblast-tnt

override_dh_auto_install:
	cp build_xblast-tnt-mini/xblast debian/xblast-tnt/usr/games/xblast-tnt-mini
	cp build_xblast-tnt-smpf/xblast debian/xblast-tnt/usr/games/xblast-tnt-smpf
	cp build_xblast-tnt/xblast      debian/xblast-tnt/usr/games/xblast-tnt

override_dh_installman:
	dh_installman
	mv debian/xblast-tnt/usr/share/man/man6/xblast.6x debian/xblast-tnt/usr/share/man/man6/xblast-tnt.6x
	ln -s xblast-tnt.6x.gz debian/xblast-tnt/usr/share/man/man6/xblast-tnt-mini.6x.gz
	ln -s xblast-tnt.6x.gz debian/xblast-tnt/usr/share/man/man6/xblast-tnt-smpf.6x.gz
