#!/usr/bin/make -f
#
DEB_BUILD_PARALLEL=yes
CONFIGURE_FLAGS = --with-doxygen --with-driverdir=/usr/lib/$(DEB_HOST_MULTIARCH)/tntdb --with-doxygen
export DEB_BUILD_MAINT_OPTIONS = hardening=+all


#binary-post-install/libtntdb-dev::
#	rm -f debian/libtntdb-dev/usr/share/doc/libtntdb-dev/html/jquery.js
#	cd debian/libtntdb-dev/usr/share/doc/libtntdb-dev/html/; ln -s ../../../javascript/jquery/jquery.js jquery.js
#ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
#	cd test; sqlite3 test.db < sqlite-test.sql; ./tntdb-test || /bin/true
#endif

override_dh_install:
	rm -f ./debian/tmp/usr/share/doc/tntdb/jquery.js
	cd ./debian/tmp/usr/share/doc/tntdb; ln -s ../../../javascript/jquery/jquery.js
	dh_install

override_dh_clean:
	rm -rf doc/html doc/latex
	dh_clean

override_dh_auto_configure:
	dh_auto_configure -- $(CONFIGURE_FLAGS)

override_dh_auto_test:
	find
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cp ./src/sqlite/.libs/tntdb5-sqlite.so test
	cd test; sqlite3 test.db < sqlite-test.sql; ./tntdb-test -h; ./tntdb-test || /bin/true
	rm -f test/tntdb5-sqlite.so
endif

%:
	dh $@ --with autoreconf
