#!/usr/bin/make -f
# Sample debian.rules file - Copyright 1994,1995 by Ian Jackson.
#
# Invoke each target with `./debian/rules <target>'.  All targets should be
# invoked with the package root as the current directory.

# The name of the package
P = doc-html-w3

R = debian/tmp

DIRECTORIES = \
        $(R) \
        $(R)/DEBIAN \
        $(R)/usr \
        $(R)/usr/share/doc/$(P) \
        $(R)/usr/share/doc/$(P)/css2 \
        $(R)/usr/share/doc/$(P)/html4 \
        $(R)/usr/share/doc/$(P)/dom1 \
        $(R)/usr/share/doc/$(P)/dom2 \
        $(R)/usr/share/doc/$(P)/xslt1 \
        $(R)/usr/share/doc/$(P)/xpath1 \
        $(R)/usr/share/doc/$(P)/atag1

$(DIRECTORIES):
	install -d -g root -o root -m 755 $@
	chmod g-s $@

# Builds the binary package.
build:
	dh_testdir
	touch build

# Clean $(DIRECTORIES)
clean-dir:
	dh_testdir
	dh_clean

# Undoes the effect of `make -f rules build'.
clean: clean-dir
	dh_testdir
	[ ! -f Makefile ] || make distclean cleanconfig
	rm -f debian/files* debian/substvars core debian/*~ *~ 
	rm -f build

# Makes a binary package.
binary-indep: $(DIRECTORIES) build
	dh_testroot
	dh_testdir

binary-arch: $(DIRECTORIES) build
	dh_testroot
	dh_testdir

	tar xvz -C $(R)/usr/share/doc/$(P)/css2		-f css2.tgz
	tar xvz -C $(R)/usr/share/doc/$(P)/html4 	-f html40.tgz
	tar xvz -C $(R)/usr/share/doc/$(P)/dom1		-f DOM.tgz
	tar xvz -C $(R)/usr/share/doc/$(P)/atag1	-f atag10.tgz
	cp -r REC-MathML $(R)/usr/share/doc/$(P)
	unzip -d $(R)/usr/share/doc/$(P)/dom2		DOM2.zip
	cp *.html *.gif *.jpg *.png *.css $(R)/usr/share/doc/$(P)
	cp debian/dhelp $(R)/usr/share/doc/$(P)/.dhelp
        
	dh_installdirs
	dh_installdocs
	dh_installexamples
	dh_installchangelogs
	gzip -9v $(R)/usr/share/doc/$(P)/changelog.Debian
	dh_installmenu
	dh_installmanpages -pdoc-html-w3
	dh_movefiles
	dh_fixperms
	dh_gencontrol
	dh_installdeb
	dh_md5sums
	dh_builddeb

binary:		binary-indep binary-arch

.PHONY: binary binary-arch binary-indep clean
