#!/usr/bin/make -f
# vim: set noet ft=make
# -*- makefile -*-

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

BIN:=$(shell ls tools/)
MANPAGE:=$(BIN:=.1)
FILEEXCLUDEDSOURCE:=$(shell ls dh_nodejs/dh_*)

%:
	dh $@

%.1:
	PERL5LIB=lib help2man -n $* -N --help-option=-h ./tools/$* > $*.1

override_dh_auto_configure: lib/Debian/Debhelper/Buildsystem/nodejs.pm
	dh_auto_configure

lib/Debian/Debhelper/Buildsystem/nodejs.pm: $(FILEEXCLUDEDSOURCE)
	echo OK
	./dh_nodejs/mk_regexp lib/Debian/Debhelper/Buildsystem/nodejs.pm

override_dh_auto_install: lib/Debian/Debhelper/Buildsystem/nodejs.pm $(MANPAGE)
	dh_auto_install
