#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export COMPILE_FLAGS="-O0"
export DEB_BUILD_MAINT_OPTIONS = hardening=-all
export DEB_CFLAGS_MAINT_APPEND  = -Wno-error
export DEB_LDFLAGS_MAINT_APPEND = -Wno-error
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
GIT_VERSION_DEVILUTIONX ?= $(shell git describe --tags --abbrev=0)
GIT_COMMIT_DEVILUTIONX := $(shell git rev-parse --short HEAD)

%:
	dh $@ --buildsystem=cmake --builddirectory=obj-${DEB_HOST_MULTIARCH}

override_dh_auto_configure:
	dh_auto_configure -- \
		-DNIGHTLY_BUILD=ON \
		-DVERSION_NUM=${GIT_VERSION_DEVILUTIONX} \
		-DVERSION_SUFFIX=-${GIT_COMMIT_DEVILUTIONX} \
		#-DSPAWN=ON

override_dh_auto_install:
	DESTDIR=$$(pwd)/debian/devilutionx cmake --install ./obj-${DEB_HOST_MULTIARCH}
