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

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

%:
	dh $@ --with python3

override_dh_auto_configure:
	dh_auto_configure -- -DBUILD_DOC_SUPPORT=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 \
		 -DCPACK_DEBIAN_PACKAGE_DEPENDS=python3-all-dev -DPYMORSE_SUPPORT=ON

override_dh_install:
	cd debian/tmp/usr/bin/ && mv morse morsesim && ln -s morsesim morse
	dh_install
	rm -fr $$(find $(CURDIR) -name '__pycache__')
	if test -d $(CURDIR)/debian/morse-simulator-doc/usr/share/doc/morse/html/_static/; then \
		cd $(CURDIR)/debian/morse-simulator-doc/usr/share/doc/morse/html/_static/ && \
		rm -f jquery.js underscore.js && \
		ln -s /usr/share/javascript/jquery/jquery.js && \
		ln -s /usr/share/javascript/jquery/underscore.js; \
	fi

override_dh_missing:
	dh_missing --fail-missing

override_dh_auto_build:
	cp version.py obj-*/
	dh_auto_build

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	echo "Skip upstream build time test"
endif
