#!/usr/bin/make -f

build: build-stamp
build-stamp:
	dh_testdir
	+debian/pg_buildext configure $(CURDIR) version-%v "--libdir=/usr/lib/postgresql/%v/lib --datadir=/usr/share/postgresql-%v-plsh"
	+debian/pg_buildext build $(CURDIR) version-%v
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -rf build-stamp version-?.?
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	+debian/pg_buildext install $(CURDIR) version-%v postgresql-%v-plsh
	rm $(CURDIR)/debian/postgresql-*-plsh/usr/lib/postgresql/*/lib/pgplsh.la
	rm $(CURDIR)/debian/postgresql-*-plsh/usr/share/postgresql-*-plsh/test.sql
	chmod 644 $(CURDIR)/debian/postgresql-*-plsh/usr/share/postgresql-*-plsh/*

binary binary-arch: install
	dh_testdir
	dh_testroot
	dh_installchangelogs -a
	dh_installdocs -a --all README NEWS
	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-indep:

.PHONY: build clean binary-indep binary-arch binary
