#!/usr/bin/make -f

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
export CXXFLAGS += --std=c++14 -Wall -pthread
export CXXFLAGS += $(CPPFLAGS)
export LDFLAGS += -lpthread

export CXX = g++

build: build-arch build-indep

build-arch:
	dh_testdir
	./build program
	./build man

build-indep:
	./build uguide

clean:
	dh_testdir
	dh_testroot
	./build distclean
	dh_clean

install:
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	# Add here commands to install the package into debian/stealth.
	./build install bdm debian/stealth

binary-indep:

binary-arch: build-arch install

	./build install au debian/stealth-doc

	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_installcron
	dh_installman
	dh_installinfo
	dh_installchangelogs
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-arch binary-indep
.PHONY: build build-indep build-arch clean binary-indep binary-arch binary \
	install-indep install-arch
