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

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

%:
	dh $@

override_dh_auto_build:
	for m in bson mongodb-core requireoptional; do \
		cp $$m/README.md README-$$m.md; \
		cp $$m/HISTORY.md HISTORY-$$m.md; \
	done

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd requireoptional && mkdir node_modules && cd node_modules && ln -s ../../bson && cd - && mocha
	rm -rf requireoptional/node_modules
	mkdir node_modules && cd node_modules && ln -s ../requireoptional require_optional && ln -s ../bson && ln -s ../mongodb-core
	node index.js
	rm -rf node_modules
endif

override_dh_installchangelogs:
	dh_installchangelogs -k HISTORY.md
