#! /usr/bin/make -f
#
# Debian rules extensively rewritten by Martin Mitchell <martin@debian.org>

CFLAGS = -O2 -g -DUNIX -DNOPROTO
LDFLAGS = -s
ARCH = $(shell dpkg --print-installation-architecture)
STRIP=strip

build:
# Builds the binary package.
	make CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
	touch build

clean:
# Undoes the effect of `make -f debian/rules build'.
	rm -f build
	rm -rf debian/tmp debian/substvars debian/files debian/*~
	rm -f *.o beav core

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
	test -f build || make -f debian.rules build
	rm -rf debian/tmp
	install -d -g root -m 755 -o root debian/tmp/usr/doc/beav debian/tmp/DEBIAN debian/tmp/usr/bin debian/tmp/usr/man/man1
	install -g root -m 755 -o root beav debian/tmp/usr/bin/beav
	$(STRIP) debian/tmp/usr/bin/beav
	install -g root -m 644 -o root beav.1 debian/tmp/usr/man/man1/beav.1
	gzip -9v debian/tmp/usr/man/man1/*
	cp debian/changelog debian/tmp/usr/doc/beav/changelog.Debian
	cp beav140.txt debian/tmp/usr/doc/beav
	gzip -9v debian/tmp/usr/doc/beav/*
	cp debian/copyright debian/tmp/usr/doc/beav
	dpkg-shlibdeps debian/tmp/usr/bin/beav
	dpkg-gencontrol
	chown -R root.root debian/tmp
	chmod -R g-ws debian/tmp
	dpkg --build debian/tmp ..

binary: binary-indep binary-arch

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

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