#!/usr/bin/make -f

SRCDIR=$(CURDIR)
include /usr/share/postgresql-common/pgxs_debian_control.mk

PG_BUILDEXT=pg_buildext

build build-arch: build-stamp
build-stamp:
	dh_testdir
	+$(PG_BUILDEXT) build $(CURDIR) build-%v
	$(MAKE) -C doc html
	touch build-stamp

build-indep:

clean: debian/control
	dh_testdir
	dh_testroot
	# pg_buildext clean doesn't work because build-*/doc isn't there
	#+$(PG_BUILDEXT) clean $(CURDIR) build-%v
	rm -rf build-*/
	$(MAKE) -C doc clean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	+$(PG_BUILDEXT) install $(CURDIR) build-%v postgresql-%v-plproxy

binary-arch: install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs -a --all NEWS AUTHORS doc/*.html
	dh_install -a
	dh_link -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-arch binary-indep

.PHONY: build build-arch build-indep clean binary binary-indep binary-arch debian/control
