#!/usr/bin/make -f

# DH_VERBOSE := 1

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

# export QT_SELECT=qt5

include /usr/share/dpkg/default.mk

%:
	dh $@ --sourcedirectory=warg


# GUI does not work - so there is no need to build it
# see https://lists.debian.org/debian-mentors/2017/12/msg00025.html
ifeq ($(QT_SELECT),qt5)
override_dh_auto_configure:
	dh_auto_configure
	cd gui && qmake

override_dh_auto_build:
	dh_auto_build
	cd gui && make
endif

override_dh_install:
	dh_install
ifeq ($(QT_SELECT),qt5)
	mkdir -p $(CURDIR)/debian/$(DEB_SOURCE)-gui/usr/bin
	cp -a gui/gui $(CURDIR)/debian/$(DEB_SOURCE)-gui/usr/bin/$(DEB_SOURCE)-gui
endif
	rename 's/\.pl//' debian/$(DEB_SOURCE)/usr/bin/*.pl
