#!/usr/bin/make -f
# Based on the initial work of Joey Hess and Craig Small.

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

export QT_SELECT=qt5

PACKAGE=colorcode

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	MAKEFLAGS += -j$(NUMJOBS)
endif

$(info "---------------------------------------")
$(info NUMJOBS: $(NUMJOBS))
$(info MAKEFLAGS: $(MAKEFLAGS))
$(info DEB_BUILD_OPTIONS: $(DEB_BUILD_OPTIONS))
$(info "---------------------------------------")


%:
	dh $@ --build-system=cmake


override_dh_clean:
	rm -rf debian/build
	rm -rf debian/tmp
	dh_clean

override_dh_auto_configure:
	mkdir -p debian/build
	mkdir -p debian/tmp
	cd debian/build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ../../src

override_dh_auto_build:
	cd debian/build && make

