#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

export QT_SELECT := 5

# Retrieve version info
include /usr/share/dpkg/pkg-info.mk

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

ifneq (,$(wildcard .git/config))
        CONFIG_VERSION=
else
_PACK_VER = $(shell echo $(DEB_VERSION) | awk -F'[+_~-]' '{print $$1}')
_BUILD_VER = $(shell echo $(DEB_VERSION) | awk -F'[+_~-]' '{print $$2}' | sed 's/[^0-9]//g')
ifeq ($(_BUILD_VER),)
        CONFIG_VERSION = $(_PACK_VER)
else
        CONFIG_VERSION = $(_PACK_VER).$(_BUILD_VER)
endif
endif

%:
	dh $@

override_dh_auto_configure:
	@echo "I: Current dtkwm VERSION is $(CONFIG_VERSION)"
	dh_auto_configure -- LIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH) VERSION=$(CONFIG_VERSION)

override_dh_auto_test:
	echo "skip auto test"

override_dh_missing:
	dh_missing --fail-missing
