#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DPIONEER_INSTALL_DATADIR=/usr/share/games/pioneer \
	                     -DPIONEER_INSTALL_BINDIR=/usr/games \
	                     -DPIONEER_DATA_DIR=/usr/share/games/pioneer/data \
	                     -DUSE_SYSTEM_LIBGLEW=ON \
	                     -DUSE_SYSTEM_LIBLUA=ON \
	                     -DUSE_SSE42=OFF

execute_after_dh_auto_build:
	dh_auto_build -- build-data

override_dh_auto_test:
	cd obj-* && ./unittest

# Imitate pioneer.install, but add a prefix for less generic names in PATH.
# This happens after pioneer.install so the destination directory exists.
# Each file must also be listed in not-installed for dh_missing.
cp_bin = cp --reflink=auto -a debian/tmp/usr/games/$1 \
  debian/pioneer/usr/games/pioneer-$1
execute_after_dh_install:
	$(call cp_bin,editor)
	$(call cp_bin,modelcompiler)
	$(call cp_bin,savegamedump)

execute_before_dh_clean:
	find data/models/ -name "*.sgm" -delete

# disable dwz as it's causing problems on some systems
override_dh_dwz:
