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

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_clean:
	dh_auto_clean
	rm -rf build
	rm -rf node_modules

override_dh_auto_configure:
	node-gyp configure

override_dh_auto_build:
	mkdir -p node_modules
	ln -sfT ../heya-unit node_modules/heya-unit
	ln -sfT ../heya-ice node_modules/heya-ice
	ln -sfT ../heya-unify node_modules/heya-unify
	node-gyp build

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	node tests/tests.js
endif

override_dh_install:
	dh_install
	find $(CURDIR)/debian/ -name *.node -exec chmod 644 '{}' \;


