#!/usr/bin/make -f

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

build: build-stamp
build-stamp:
	dh_testdir
	+debian/pg_buildext build $(CURDIR) build-%v
	touch build-stamp

clean: debian/control
	dh_testdir
	dh_testroot
	rm -f mkmf.log
	rm -f build-stamp
	+debian/pg_buildext clean $(CURDIR) build-%v
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	+debian/pg_buildext install $(CURDIR) build-%v postgresql-%v-pllua

binary-arch: install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs -a --all docs/index.html docs/style.css
	dh_installexamples -a --all sql/plluatest.sql expected/plluatest.out
	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 clean binary-indep binary-arch binary debian/control
