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

# Uncommented to turn on verbose mode.
export DH_VERBOSE = 1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_BUILD_HARDENING = 1

export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)

export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
export CXXFLAGS += -Wall -pthread -D_FORTIFY_SOURCE=2

# Define the c++std to use by processing the upstream 'c++std' file
export CXXFLAGS += $(shell cat c++std|sed -e 's/#define CPPSTD "//' -e 's/"//')

export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) -Wl,-z,now

export CXX = g++

%:
	dh $@

override_dh_auto_build:
	./build program
	./build man
	dh_auto_build

override_dh_auto_clean:
	./build clean
	dh_auto_clean

override_dh_auto_install:
	./build install x debian/natlog
	dh_install etc/natlog.conf etc/
	dh_auto_install

override_dh_installinit:
	dh_installinit --no-start --no-enable

override_dh_installsystemd:
	dh_installsystemd --no-start --no-enable
