#!/usr/bin/make -f
#
# This is a special rules files for handling alien or binary packages
# Christoph Lameter, October 30, 1996

package=an
STRIP=strip

debian/build:
	$(checkdir)
	touch debian/build
	cd an-0.93;make clean;make
clean:
	$(checkdir)
	-rm -f debian/build
	-rm -rf *~ debian/tmp debian/*~ debian/files*
	cd an-0.93;make clean

binary-indep:	checkroot debian/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 debian/build
	$(checkdir)
	-rm -rf debian/tmp
# Install binary package
	install -d debian/tmp

# create dirs
	install -d -o root -g root -m 0755 debian/tmp/usr/games
	install -d -o root -g root -m 0755 debian/tmp/DEBIAN
	install -d -o root -g root -m 0755 debian/tmp/usr/doc/an
# install files
	install -o root -g root -m 0755 an-0.93/an debian/tmp/usr/games/an
	$(STRIP) debian/tmp/usr/games/an
	install -o root -g root -m 0644 an-0.93/README debian/tmp/usr/doc/an/README
	install -o root -g root -m 0644 an-0.93/EXAMPLE.ANAGRAMS debian/tmp/usr/doc/an/EXAMPLE.ANAGRAMS
	install -o root -g root -m 0644 an-0.93/TODO debian/tmp/usr/doc/an/TODO
	
	install -o root -g root -m 0644 an-0.93/HINTS debian/tmp/usr/doc/an/HINTS
	install -o root -g root -m 0644 debian/changelog debian/tmp/usr/doc/an/changelog.Debian
	gzip -9v debian/tmp/usr/doc/an/*
	install -o root -g root -m 0644 debian/copyright debian/tmp/usr/doc/an
	install -d -o root -g root -m 0755 debian/tmp/usr/man/man6
	install -o root -g root -m 0644 an-0.93/an.6 debian/tmp/usr/man/man6
	gzip -9v debian/tmp/usr/man/man6/*

#	cp -a `ls | grep -v debian` debian/tmp

#
# If you need to move files around in debian/tmp or do some
# binary patching ... Insert it here
#
	dpkg-shlibdeps debian/tmp/usr/games/an
	dpkg-gencontrol
	dpkg --build debian/tmp ..

define checkdir
	test -f debian/rules
endef

# Below here is fairly generic really

binary:		binary-indep binary-arch

build:	debian/build

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
