#!/usr/bin/make -f

# Get version from changelog as well as lsb_release
# to compute unique build version (useful for repo mirroring systems doing file pooling)
PKG_VERSION  := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
DIST_NAME    := $(shell lsb_release -si)
DIST_RELEASE := $(shell lsb_release -sc)
DIST_VERSION := $(shell lsb_release -sr)

export PYBUILD_NAME=keras

%:
	dh $@ --with python2,python3 --buildsystem=pybuild

override_dh_auto_build:
	dh_auto_build
	cd "$(CURDIR)/docs" \
	  && LC_ALL=C.UTF-8 PYTHONPATH="$(CURDIR)" python3 autogen.py  \
          && LC_ALL=C.UTF-8 mkdocs build --site-dir "$(CURDIR)/docs/html"

override_dh_auto_clean:
	dh_auto_clean
	rm -rf "$(CURDIR)/docs/sources" "$(CURDIR)/docs/html"

override_dh_gencontrol:
	dh_gencontrol -- -v"$(PKG_VERSION)+$(DIST_NAME)-$(DIST_RELEASE)-$(DIST_VERSION)"
