#!/usr/bin/make -f
# debian/rules for memstat
#
# based on debian.rules from hello.deb (Ian Jackson)
# Changes are Copyright 1998 by Bernd Eckenfels
#
# I hereby give you perpetual unlimited permission to copy,
# modify and relicense this file, provided that you do not remove
# my name from the file itself.  (I assert my moral right of
# paternity under the Copyright, Designs and Patents Act 1988.)
# This file may have to be extensively modified

package=memstat

build:
	$(checkdir)
	$(MAKE) prefix=/usr
	touch build

clean:
	$(checkdir)
	-rm -f build
	-rm -rf *~ *.o memstat debian/tmp debian/files* debian/substvars

binary-indep:	checkroot build
	$(checkdir)
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch:	checkroot build
	$(checkdir)
	-rm -rf debian/tmp
	install -d debian/tmp debian/tmp/DEBIAN
	install -d debian/tmp/usr/share/doc/$(package)
	install -d debian/tmp/usr/share/man/man1/
	install -d debian/tmp/etc
	$(MAKE) prefix=debian/tmp/usr install
	cp memstat.8 debian/tmp/usr/share/man/man1/memstat.1
	cp debian/copyright debian/tmp/usr/share/doc/$(package)/.
	cp debian/changelog debian/tmp/usr/share/doc/$(package)/changelog
	cp memstat.tut debian/tmp/usr/share/doc/$(package)/memstat-tutorial.txt
	cp memstat.conf debian/tmp/etc/
	cp debian/conffiles debian/tmp/DEBIAN/
	chmod 644 debian/tmp/usr/share/man/man1/* debian/tmp/usr/share/doc/$(package)/*
	dpkg-shlibdeps memstat
	dpkg-gencontrol -isp
	dh_strip
	dh_compress
	dh_fixperms
	dh_md5sums
	dh_builddeb

define checkdir
	test -f $(package).c -a -f debian/rules
endef

# Below here is fairly generic really

binary:		binary-indep binary-arch

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

checkroot:
	$(checkdir)
	test root = "`whoami`"

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