#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

DEBIAN_DIR := $(dir $(firstword $(MAKEFILE_LIST)))
SCONS = scons --directory $(DEB_BUILDDIR) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" SHLINKFLAGS="$(LDFLAGS)"
SCONS_OPTS = DESTDIR="$(CURDIR)/debian/tmp/" PREFIX=/usr

get-orig-source:
	uscan --destdir $(CURDIR) \
	      --watchfile $(DEBIAN_DIR)/watch \
		  --repack \
		  --rename \
		  --force-download

override_dh_auto_clean:
	scons --keep-going --clean distclean || true
	rm -rf docs/html \
	       options.cache \
		   .sconsign.dblite \
		   site_scons/site_tools/*.pyc

override_dh_auto_build:
	$(SCONS) $(SCONS_OPTS)
	$(SCONS) docs $(SCONS_OPTS)

override_dh_auto_install:
	$(SCONS) install $(SCONS_OPTS)

%:
	dh $@
