#!/usr/bin/make -f
#export DH_VERBOSE=1
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# Build without Altivec on ppc64el to prevent build failures
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
ifeq ($(DEB_HOST_ARCH),ppc64el)
export DEB_CXXFLAGS_MAINT_APPEND := -mno-altivec
endif

ifneq (,$(filter $(DEB_HOST_ARCH), armhf armel m68k mips mipsel powerpc powerpcspe sh4))
export DEB_LDFLAGS_MAINT_APPEND = -latomic
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		-DCMAKE_VERBOSE_MAKEFILE=ON \
		-DENABLE_TOOLS=ON \
		-DCMAKE_INSTALL_PREFIX=/usr

override_dh_install:
	dh_install
	$(RM) debian/performous-tools/usr/games/performous

override_dh_missing:
	dh_missing --fail-missing

get-orig-source:
	uscan --download-current-version --force-download
