#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic

%:
	dh $@ --buildsystem=meson

override_dh_auto_configure:
	dh_auto_configure -- \
		-Ddynamic-linking=true

# Upstream installs a <platform>-debugcc symlink to the main debugcc binary for
# each supported platform - create symlinks to the main debugcc manpage for all
# binaries.
override_dh_link:
	set -e; \
	links=; \
	for bin in debian/debugcc/usr/bin/*-debugcc; do \
		test -e "$$bin" || { \
			echo "E: no <platform>-debugcc binaries found" >&2; \
			exit 1; \
		}; \
		links="$$links usr/share/man/man1/debugcc.1"; \
		links="$$links usr/share/man/man1/$$(basename $$bin).1"; \
	done; \
	dh_link -- $$links
