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

%:
	dh $@ --parallel

override_dh_auto_build-arch:
	# Set HOME to an existent directory as a workaround for #544835. Note that
	# HOME isn't actually used, but some buildds set it to a non-existent
	# directory, and PhysicsFS currently fails if the directory doesn't exist
	# (see #553174).
	$(MAKE) $(shell dpkg-buildflags --export=configure) \
		DATADIR=/usr/share/games/neverball \
		LOCALEDIR=/usr/share/locale \
		HOME=$(CURDIR) executables
	# Rename icons for .desktop files.
	cp $(CURDIR)/dist/neverball_128.png $(CURDIR)/dist/neverball.png
	cp $(CURDIR)/dist/neverputt_128.png $(CURDIR)/dist/neverputt.png

override_dh_auto_build-indep:
	$(MAKE) \
		DATADIR=/usr/share/games/neverball \
		LOCALEDIR=/usr/share/locale \
		HOME=$(CURDIR) data

override_dh_auto_clean:
	[ ! -f Makefile ] || $(MAKE) clean
	rm -f $(CURDIR)/dist/neverball.png $(CURDIR)/dist/neverputt.png

override_dh_auto_test:
	# Disable dh_auto_test to prevent FTBFS because of Initialization error.
	# DirectFB/Core: Could not initialize 'system_core' core!

override_dh_auto_install:
	# The Makefile does not provide an install target thus do nothing here.

override_dh_installchangelogs:
	dh_installchangelogs CHANGES

override_dh_strip:
	dh_strip --dbg-package=neverball-dbg
