#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# Using pg_buildext
include /usr/share/postgresql-common/pgxs_debian_control.mk

export USE_PGXS=1

%:
	dh $@

override_dh_builddeb:
	dh_builddeb -- -Zgzip

override_dh_auto_build:
	+pg_buildext clean . build-%v
	+pg_buildext build . build-%v

override_dh_auto_test:
	# nothing to do here

override_dh_auto_install:
	# Not pg_buildext install: it adds postgresql-NN to ${misc:Depends} when
	# control does not use ${postgresql:Depends}, and pg-telemetry must not pull
	# in the server. This is the same make install, without the substvars.
	$(MAKE) -C build-16 -f $(CURDIR)/Makefile install \
		DESTDIR=$(CURDIR)/debian/percona-pg-telemetry16 \
		PG_CONFIG=/usr/lib/postgresql/16/bin/pg_config \
		VPATH=$(CURDIR) USE_PGXS=1

override_dh_installdocs:
	dh_installdocs --all README.*

override_dh_auto_clean:
	rm -rf results/* regression.*
