#!/usr/bin/make -f

SRCDIR = $(CURDIR)
include /usr/share/postgresql-common/pgxs_debian_control.mk
clean: debian/control
.PHONY: debian/control

override_dh_auto_build:
	+pg_buildext build $(CURDIR) build-%v

override_dh_auto_test:
	# no tests here, we are using autopkgtest

override_dh_auto_clean:
	+pg_buildext clean $(CURDIR) build-%v
	rm -rf build-?.? debian/postgresql-?.?-plr* debian/*.postinst regression.* results plr.sql

override_dh_installdocs:
	dh_installdocs --all doc/*.html

override_dh_auto_install:
	+pg_buildext install $(CURDIR) build-%v postgresql-%v-plr

override_dh_installdeb:
	# lucid's r-base-core doesn't ship /usr/lib/libR.so, create a symlink to /usr/lib/R/lib/libR.so
	# newer dists are ok
	for i in `pg_buildext supported-versions`; do \
		cp debian/postinst debian/postgresql-$$i-plr.postinst; \
	done
	dh_installdeb

%:
	dh $@
