#!/usr/bin/make -f
# -*- makefile -*-

export DH_VERBOSE = 1
include /usr/share/dpkg/pkg-info.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export PYBUILD_NAME=piqtree

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_CXXFLAGS_MAINT_APPEND = $(shell dpkg-buildflags --get CPPFLAGS)
export SKBUILD_CMAKE_DEFINE = IQTREE_LIB=/usr/lib/$(DEB_HOST_MULTIARCH)/libiqtree.so;CMAKE_VERBOSE_MAKEFILE=ON


export PYBUILD_AFTER_INSTALL=rm -fr {destdir}/usr/lib/python3*/dist-packages/$(PYBUILD_NAME)-*/top_level.txt

include /usr/share/dpkg/pkg-info.mk

%:
	dh $@ --buildsystem=pybuild

execute_before_dh_clean:
	rm -rf html

execute_after_dh_auto_build:
ifeq (,$(findstring nodoc, $(DEB_BUILD_PROFILES)))
	PYTHONPATH=`dirname $$(find .pybuild/ -type d -name "*piqtree*dist-info" | head -n1)` \
	    python3 -m mkdocs build -v -d html
	rm html/sitemap.xml.gz
endif
