#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@

override_dh_auto_configure:
	# We configure by writing to Makefile.local
	echo "INSTALL_DIR=debian/openttd-opengfx/usr/share/games/openttd/data/opengfx" >> Makefile.local
	# Force nforenum to store its datafiles in ./.renum instead of
	# trying ~/.renum
	echo "NFORENUM_FLAGS=-D." >> Makefile.local
	# Don't install these into the datadir, we'll let dh handle
	# these.
	echo "DO_NOT_INSTALL_CHANGELOG=1" >> Makefile.local
	echo "DO_NOT_INSTALL_LICENSE=1" >> Makefile.local
	echo "DO_NOT_INSTALL_DOCS=1" >> Makefile.local


override_dh_auto_build:
	# Docs are not built by default
	make all docs

override_dh_auto_test:
	# Check if the md5 sums of the resulting grf files match. This
	# ensures no problems will arise in online play, which uses both
	# version info and md5 sums of files. We don't use dh_auto_test
	# here, because "make test" is also supported, but gives debug
	# output.
	make check

override_dh_auto_clean:
	make distclean
	# Remove some files make distclean leaves (and even generates,
	# since dependency information is generated before every
	# target...).
	rm -f sprites/*.cnfo
	# Remove our Makefile.local
	rm -f Makefile.local
	# Clean up the stuff nforenum leaves around.
	rm -rf .nforenum

override_dh_installchangelogs:
	dh_installchangelogs docs/changelog.txt
