#!/usr/bin/make -f
EXTN=adodb
BUILD=$(CURDIR)/debian/php5-$(EXTN)
PHP_EX=$(shell /usr/bin/php-config5 --extension-dir)

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk

CFLAGS += -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security
DEB_CONFIGURE_EXTRA_FLAGS = --disable-rpath --with-php-config=/usr/bin/php-config5
DEB_MAKE_INSTALL_TARGET =

makebuilddir/php5-$(EXTN)::
	[ -f configure ] || phpize5

clean::
	phpize5 --clean

install/php5-$(EXTN)::
	install -D -m 644 modules/$(EXTN).so $(BUILD)$(PHP_EX)/$(EXTN).so
	install -D -m 644 debian/$(EXTN).ini $(BUILD)/etc/php5/mods-available/$(EXTN).ini
	echo "php:Depends=phpapi-`php-config5 --phpapi`" >> $(BUILD).substvars
