#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
export DH_VERBOSE = 1

TARGETS = $(shell cat debian/targets | grep $(DEB_HOST_GNU_TYPE))

override_dh_clean:
	dh_clean
	rm -rf libmali-*/
	rm -rf debian/libmali-*/

override_dh_auto_configure:
	for target in $(TARGETS); do \
		export $$(scripts/parse_name.sh $$target); \
		dh_auto_configure --builddirectory=$$name -- \
			-Darch=$${target%%-*} -Dgpu=$$gpu \
			-Dversion=$$version -Dsubversion=$$subversion \
			-Dplatform=$$platform -Dvendor-package=true -Dwrappers=enabled; \
	done

override_dh_auto_build:
override_dh_auto_test:

override_dh_auto_install:
	for target in $(TARGETS); do \
		export $$(scripts/parse_name.sh $$target); \
		dh_auto_install --builddirectory=$$name \
			--destdir=debian/$$name; \
	done

%:
	dh $@ --buildsystem=meson
