#!/usr/bin/make -f
# derived from Sample debian.rules file - for GNU Hello (1.3).
# Copyright 1994,1995 by Ian Jackson.
# 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

# There used to be `source' and `diff' targets in this file, and many
# packages also had `changes' and `dist' targets.  These functions
# have been taken over by dpkg-source, dpkg-genchanges and
# dpkg-buildpackage in a package-independent way, and so these targets
# are obsolete.

# atypical, no diff target, source contains no doc files

package=doc-debian
# debloc has to point to a current Debian FTP mirror
debloc=/ftp-debian/

# The next section may have to be extensively modified

build:
	@echo "Hope the mirror of debian is recent..."
	(cd FAQ; make)
	touch stamp-build

clean:
	(cd FAQ; make clean)
	-rm -rf debian/tmp *~ debian/*~
	-rm stamp-build

binary-indep:	checkroot build
	test -f stamp-build || make -i -f debian.rules build
	-rm -rf debian/tmp
	install -d debian/tmp/DEBIAN 
	cp debian/{postinst,prerm} debian/tmp/DEBIAN/
	install -d debian/tmp/usr/doc/$(package)
	install -c -m 644 debian/copyright debian/tmp/usr/doc/$(package)/
	cp -a $(debloc)/doc debian/tmp/usr/doc/debian
	rm -rf debian/tmp/usr/doc/debian/FAQ
	rm -f debian/tmp/usr/doc/debian/package-developer/{policy,programmer}.{html.tar.gz,*ps.gz} debian/tmp/usr/doc/debian/{.mirror,00-INDEX}
	find debian/tmp/usr/doc/debian -type f | \
		xargs chmod 644
	find debian/tmp/usr/doc/debian -type d | \
		xargs chmod 755
	(cd debian/tmp/usr/doc/debian; rm -f .mirrorinfo mirrors.txt)
	cp $(debloc)/README.mirrors debian/tmp/usr/doc/debian/mirrors.txt
	(cd debian/tmp/usr/doc/debian/package-developer; rm -rf \
		.mirrorinfo fsstnd-1.2.lj4.gz guidelines.* \
		hello* obsolete )
#	find debian/tmp/usr/doc/debian -type f | \
#		grep -v '\.gz$$' | xargs gzip -9
	install -d debian/tmp/usr/info
	install -c -m 644 FAQ/debian-faq.info debian/tmp/usr/info
	gzip -9 debian/tmp/usr/info/debian-faq.info
	chown -R root.root debian/tmp
	chmod -R go-ws debian/tmp
	dpkg-gencontrol
	dpkg --build debian/tmp ..

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


define checkdir
	test -d FAQ
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