#!/usr/bin/make -f
#-*- makefile -*-
# Made with the aid of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# Some lines taken from debmake, by Christoph Lameter.

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

CFLAGS = -O2 -Wall
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS += -g
endif

build: build-stamp
build-stamp:
	dh_testdir

	$(MAKE) CFLAGS="$(CFLAGS)"

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp install-stamp

	[ ! -f Makefile ] || $(MAKE) clean WITH_SENSORS=1 

	dh_clean

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs -A usr/bin usr/share/man/man1

	$(MAKE) install DESTDIR=$(CURDIR)/debian/mrtgutils
	mv debian/mrtgutils/usr/share/man/man1/mrtg-sensors.1.gz debian/mrtgutils-sensors/usr/share/man/man1 
	mv debian/mrtgutils/usr/bin/mrtg-sensors debian/mrtgutils-sensors/usr/bin

	touch install-stamp

binary-indep: build install

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installman
	dh_installchangelogs 
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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