#!/usr/bin/make -f

# Output every command that modifies files on the build system.
export DH_VERBOSE = 1

# Apply all hardening options
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# The shared memory interface (SMI) version is exposed as a versioned
# virtual package so that shairport-sync can require a matching nqptp.
SMI_VERSION := $(shell sed -n 's/^\#define NQPTP_SHM_STRUCTURES_VERSION[[:space:]]*//p' nqptp-shm-structures.h)
ifeq ($(SMI_VERSION),)
$(error Could not determine NQPTP_SHM_STRUCTURES_VERSION from nqptp-shm-structures.h)
endif

%:
	dh $@

override_dh_gencontrol:
	dh_gencontrol -- -Vnqptp:smi=$(SMI_VERSION)

override_dh_auto_configure:
	dh_auto_configure -- \
		CFLAGS="$(CFLAGS) $(CPPFLAGS)" \
		CPPFLAGS="" \
		--with-systemd-startup

override_dh_installchangelogs:
	dh_installchangelogs --keep RELEASE_NOTES.md
