#!/usr/bin/make -f

#DH_VERBOSE = 1
#include /usr/share/dpkg/default.mk
export LC_ALL=C.UTF-8

export FALCON_WORKSPACE=$(CURDIR)
export FALCON_PREFIX=$(CURDIR)/inst
export FALCON_INSTALL_RULE=install

export PYTHONPATH:=$(FALCON_PREFIX)/pylib:$(PYTHONPATH)

%:
	dh $@ --with python2

override_dh_auto_build:
	mkdir -p \
		$(FALCON_PREFIX)/bin \
		$(FALCON_PREFIX)/include \
		$(FALCON_PREFIX)/lib \
		$(FALCON_PREFIX)/pylib
	$(MAKE) all

override_dh_auto_test: unit-tests integration-tests ;

.PHONY: unit-tests
unit-tests:
	nosetests -v FALCON/test/

.PHONY: integration-tests
integration-tests:
	PATH=$(FALCON_PREFIX)/bin:$(PATH) $(MAKE) test
	$(MAKE) -C FALCON-examples clean-synth0

override_dh_install:
	dh_install -XLICENSE

override_dh_auto_clean:
	dh_auto_clean
	$(RM) -r $(FALCON_PREFIX)
