#!/usr/bin/make -f

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
CFLAGS += $(shell pkg-config --cflags bson2) -Wno-error=missing-variable-declarations

%:
	dh $@ --with pgxs_loop

override_dh_installdocs:
	cp internal/pg_documentdb_distributed/NOTICE NOTICE_documentdb_distributed
	dh_installdocs --all README.* NOTICE*

	set -eux; for v in $(shell pg_buildext supported-versions); do \
		echo "custom-library-search-path RUNPATH /usr/lib/postgresql*" > debian/postgresql-$$v-documentdb.lintian-overrides; \
	done

override_dh_auto_clean:
	rm -f NOTICE_documentdb_distributed
	dh_auto_clean

override_dh_pgxs_test:
	# skip build-time tests, RPATH points at /usr/lib/postgresql
