#!/usr/bin/make -f
# derived from sample debian/rules file for GNU hello by Ian Jackson.

tmp = $(CURDIR)/debian/tmp
docdir = $(tmp)/usr/share/doc/debian

build: stamp-build
stamp-build:
	test -f debian/rules
	touch $@

clean:
	test -f debian/rules
	test "`id -u`" -eq 0
	rm -rf $(tmp)
	rm -f stamp-build debian/files `find . -name "*~"`

refresh:
	cd doc && $(MAKE)

binary: binary-indep binary-arch

binary-arch:

binary-indep: build
	test -f debian/rules
	test "`id -u`" -eq 0
	rm -rf $(tmp)

	install -m 755 -d $(tmp)/DEBIAN \
          $(tmp)/usr/share/doc-base $(tmp)/usr/share/doc/doc-debian $(docdir)
# Copy all the contents of doc/
	cp -p doc/* $(docdir)
# Save for the files that are used to auto-generate them
	rm -f $(docdir)/*wml
	rm -f $(docdir)/Makefile

	install -m 755 debian/prerm debian/postinst $(tmp)/DEBIAN
	install -m 644 doc-base/* $(tmp)/usr/share/doc-base
	install -m 644 debian/copyright $(tmp)/usr/share/doc/doc-debian
	gzip -c9 debian/changelog > $(tmp)/usr/share/doc/doc-debian/changelog.gz
	chown -R root.root $(tmp) && chmod -R go=rX $(tmp)
	dpkg-gencontrol -isp
	dpkg --build $(tmp) ..



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