#!/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

# This avoids clashing with the file in firmware-nonfree.
FW_FILENAME_VER = 1.dev.0

%:
	dh $@

override_dh_auto_build-indep: $(stamp)gcc_xtensa-elf
	dh_auto_build --buildsystem=makefile --sourcedir=target_firmware -- CROSS_COMPILE="$(toolchain_dir)/bin/xtensa-elf-"

override_dh_auto_clean:
	dh_auto_clean --buildsystem=makefile --sourcedir=target_firmware -- CROSS_COMPILE="$(toolchain_dir)/bin/xtensa-elf-"

execute_before_dh_install:
	mv target_firmware/htc_9271.fw target_firmware/htc_9271-$(FW_FILENAME_VER).fw
	mv target_firmware/htc_7010.fw target_firmware/htc_7010-$(FW_FILENAME_VER).fw
