#!/usr/bin/make -f

include /usr/share/postgresql-common/pgxs_debian_control.mk

VERSIONS=$(shell pg_buildext supported-versions)

override_dh_auto_configure:
	# nothing to do here, see override_dh_auto_install instead

override_dh_auto_build:
	# nothing to do here, see override_dh_auto_install instead

override_dh_auto_test:
	# nothing to do here, see debian/tests/* instead

override_dh_auto_install:
	+set -eux; for v in $(VERSIONS); do \
	  [ -f pgsql/Makefile ] && $(MAKE) -C pgsql distclean; \
	  dh_auto_configure -- --with-pgconfig=/usr/lib/postgresql/$$v/bin/pg_config GITCMD=false; \
	  $(MAKE); \
	  $(MAKE) install DESTDIR=$(CURDIR)/debian/postgresql-$$v-pointcloud; \
	done

override_dh_installdocs:
	dh_installdocs --all README.*

override_dh_auto_clean:
	touch config.mk
	dh_auto_clean

%:
	dh $@ --with autoreconf
