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

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

%:
	dh $@

override_dh_auto_clean:
	dh_auto_clean
	rm -f mocha.js
	rm -f mocha.min.js
	rm -rf images
	rm -rf docs/_site

override_dh_auto_build:
	mkdir -p images
	ln -fs /usr/share/icons/oxygen/base/22x22/actions/dialog-ok-apply.png images/ok.png
	ln -fs /usr/share/icons/oxygen/base/22x22/actions/dialog-cancel.png images/error.png
	dh_auto_build
	uglifyjs -o mocha.min.js mocha.js

override_dh_install:
	dh_install
	find debian/mocha -name .eslintrc.yml -delete
	find debian/libjs-mocha -name .eslintrc.yml -delete

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
	$(MAKE) test-node
else
	@echo '**********************************************************'
	@echo 'Skip test suite                                           '
	@echo '**********************************************************'
endif

override_dh_installdocs:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
	jekyll build --source ./docs --destination ./docs/_site --config ./docs/_config.yml --safe --drafts
else
	@echo '**********************************************************'
	@echo 'Skip building doc                                         '
	@echo '**********************************************************'
endif
	dh_installdocs --link-doc=libjs-mocha
