#!/usr/bin/make -f

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

# see FEATURE AREAS in dpkg-buildflags(1)
ifneq (,$(findstring amd64,$(DEB_BUILD_ARCH)))
export DEB_BUILD_MAINT_OPTIONS = hardening=+fortify,-stackprotector,+relro,+bindnow,-pie
else
export DEB_BUILD_MAINT_OPTIONS = hardening=+fortify,-stackprotector,+relro,+bindnow,+pie
endif

env_cmd = env DEB_BUILD_MAINT_OPTIONS=$(DEB_BUILD_MAINT_OPTIONS)

# := as there's no configure script in the middle right now and we want
#    to see explicit flags in the build log.
# env: export has no effect on $(shell)
CFLAGS  := $(shell $(env_cmd) dpkg-buildflags --get CFLAGS)
CFLAGS  += $(shell $(env_cmd) dpkg-buildflags --get CPPFLAGS)
LDFLAGS := $(shell $(env_cmd) dpkg-buildflags --get LDFLAGS)

export CFLAGS LDFLAGS

%:
	dh $@

get-orig-source:
	uscan --force-download

.PHONY: get-orig-source
