#!/usr/bin/make -f

# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

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)


%:
	dh $@ --sourcedirectory=hostapd

override_dh_install:
	dh_install
	# change location and name of the built binaries
	mv debian/hostapd-mana/usr/local/bin/hostapd debian/hostapd-mana/usr/sbin/hostapd-mana
	mv debian/hostapd-mana/usr/local/bin/hostapd_cli debian/hostapd-mana/usr/sbin/hostapd-mana_cli
	# install the config file with new name to avoid conflict with
	# hostapd
	cp hostapd/hostapd.conf debian/hostapd-mana/etc/hostapd-mana/hostapd-mana.conf
	cp hostapd/hostapd.eap_user debian/hostapd-mana/etc/hostapd-mana/hostapd-mana.eap_user
