#!/usr/bin/make -f
export DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
include debian/cross-toolchain.mk

# Stack protector needs to be disabled since that entails linking to libssp.
# Other hardening flags likewise cause more problems than they solve.
export DEB_BUILD_MAINT_OPTIONS=hardening=-all

FW_FILENAME_VER = 1.4.0

%:
	CROSS_COMPILE="$(toolchain_dir)/bin/xtensa-elf-" \
	dh $@ --buildsystem=makefile --sourcedirectory=target_firmware

override_dh_auto_build: $(stamp)gcc_xtensa-elf
	dh_auto_build --

execute_before_dh_install:
	if [ -f target_firmware/htc_9271.fw ]; \
	then mv target_firmware/htc_9271.fw target_firmware/htc_9271-$(FW_FILENAME_VER).fw; \
	fi
	if [ -f target_firmware/htc_7010.fw ]; \
	then mv target_firmware/htc_7010.fw target_firmware/htc_7010-$(FW_FILENAME_VER).fw; \
	fi