#!/usr/bin/make -f

verbose := $(if $(filter terse,$(DEB_BUILD_OPTIONS)),,V=1)

%:
	dh $@

# The upstream build system is designed for people building only the
# platform matching their hardware.
# Debian wants to support several platforms, but build and install
# only one representant per defconfig.
# The supported platforms and their testers are listed in
# debian/deputy.manifest.
# The following list contains the actually built platforms.
platforms := $(shell python3 debian/rules.py)

override_dh_auto_build: $(platforms)
$(platforms):
	dh_auto_build -- $(verbose) TGT=build/$@ $@_defconfig
	dh_auto_build -- $(verbose) TGT=build/$@ CROSS_COMPILE=or1k-elf- \
	  build/$@/$@.bin
