#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

include /usr/share/dpkg/architecture.mk

%:
	dh $@  --with python3 --with sphinxdoc

# afffected by https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=727621
ifeq (armel,$(findstring armel,$(DEB_HOST_ARCH)))
CONFIGURE_FLAGS_EXTRA += --disable-threads
endif

override_dh_auto_build-arch:
	dh_autoreconf
	dh_auto_configure -- --disable-silent-rules --with-boost-libdir=/usr/lib/$(DEB_HOST_MULTIARCH) --enable-static $(CONFIGURE_FLAGS_EXTRA)
	dh_auto_build

override_dh_auto_build-indep:
	cd doc && \
		doxygen doxygen.conf && \
		mkdir tmp && sphinx-build -v -a . tmp

override_dh_auto_clean:
	dh_auto_clean
	dh_autoreconf_clean
	rm -f src/ixion-test
	rm -f src/libixion/ixion-test
	rm -rf doc/_doxygen doc/tmp

override_dh_auto_configure:

override_dh_auto_test:
	if [ -d $(CURDIR)/src/python/.libs ]; then \
		PYTHONPATH="$(CURDIR)/src/python/.libs" dh_auto_test; \
	fi

override_dh_auto_install:
	# otherwise dh_auto_install -plibixion-doc doesn't work because there's
	# no debian/tmp it can cd from
	mkdir -p debian/tmp
	if [ -d src/.libs ]; then dh_auto_install; else dh_auto_install -- -plibixion-doc; fi

override_dh_makeshlibs:
	dh_makeshlibs -VNone

