#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# The build system doesn't use CPPFLAGS, pass them to CFLAGS/CXXFLAGS to
# enable the missing (hardening) flags
export DEB_CFLAGS_MAINT_APPEND   = -MMD -Wall $(shell dpkg-buildflags --get CPPFLAGS)
export DEB_CXXFLAGS_MAINT_APPEND = $(shell dpkg-buildflags --get CPPFLAGS)
export DEB_LDFLAGS_MAINT_APPEND  = -Wl,--as-needed

BINDIR    = /sbin
V = 1

DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
        CC=$(DEB_HOST_GNU_TYPE)-gcc
endif

export CC BINDIR V

%:
	dh $@

override_dh_auto_build:
	dh_auto_build --sourcedirectory=hostapd --buildsystem=makefile --parallel

override_dh_install:
	chmod 755 hostapd/certs/bootstrap
	dh_install
