#!/usr/bin/make -f
export DH_VERBOSE=1
export TF_CFLAGS += -ffile-prefix-map=$(CURDIR)=.

# Enable verbose build by default, disable when terse is specified.
ifneq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
VERBOSE=0
else
VERBOSE=1
endif

%:
	dh $@

override_dh_auto_build:
# Only build firmware on arm64.
ifeq ($(DEB_HOST_ARCH),arm64)
	# Always set CROSS_COMPILE, which also works for native builds.
	grep -v '^#' debian/targets | while read plat targets ; do \
		CC= CROSS_COMPILE=aarch64-linux-gnu- CFLAGS= LDFLAGS= dh_auto_build -- VERBOSE=1 DEBUG=1 PLAT=$$plat bl31 ; \
	done
endif

override_dh_installchangelogs:
	dh_installchangelogs -parm-trusted-firmware-phytec-tauri-l2 docs/change-log.rst
