#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Ithird_party/md5 -Ithird_party/json -Iinclude -fPIC
DEB_CXXFLAGS_MAINT_APPEND = -Ithird_party/md5 -Ithird_party/json -Iinclude -fPIC
DEB_CXXFLAGS_MAINT_APPEND += $(shell dpkg-buildflags --get CPPFLAGS)
export DEB_CXXFLAGS_MAINT_APPEND

%:
	dh $@ -Scmake --with python3

override_dh_auto_configure:
	dh_auto_configure -- \
		-DUSE_SYSTEM_GTEST=ON \
		-DBUILD_JSONNET=ON \
		-DBUILD_TESTS=ON

override_dh_auto_build:
	dh_auto_build
	for PY in $(shell py3versions -rs); do \
		$$PY setup.py build; done

override_dh_auto_install:
	dh_auto_install
	for PY in $(shell py3versions -rs); do \
		$$PY setup.py install --install-layout=deb \
		--root=$(shell pwd)/debian/tmp; done
	rm -f $(CURDIR)/debian/tmp/usr/share/doc/jsonnet/html/_layout/base.html

override_dh_auto_clean:
	dh_auto_clean -O-Scmake
	dh_auto_clean -O-Smakefile
