#! /usr/bin/make -f

export DH_VERBOSE=

MAKEOPTS = CONFIG=debian/Makefile.config

build: build-stamp
build-stamp:
	dh_testdir
	dh_installdirs
	
	$(MAKE) build     $(MAKEOPTS)
	$(MAKE) build-doc $(MAKEOPTS)
	$(MAKE) build-man $(MAKEOPTS)
	
	$(MAKE) install-main $(MAKEOPTS) \
		DESTDIR=debian/munin
	
	$(MAKE) install-node install-node-plugins $(MAKEOPTS) \
		DESTDIR=debian/munin-node
	
	install -m0644 debian/plugins.conf \
		$(CURDIR)/debian/munin-node/etc/munin/plugin-conf.d/munin-node
	
	touch build-stamp

clean:
	dh_testdir
	dh_clean
	-$(MAKE) clean

binary: binary-indep

binary-arch:

binary-indep: build-stamp
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installchangelogs ChangeLog
	dh_installman
	dh_installinit
	dh_installcron
	dh_installlogrotate
	dh_installdebconf
	dh_link
	dh_fixperms
	dh_compress
	dh_perl
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

.PHONY: build clean binary binary-arch binary-indep
