#!/usr/bin/make -f
# Rules file for package w3c-dtd-xhtml
# Adapted from the sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
# Inspired from the rules file of package docbook-xml

# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

# This is the debhelper compatibility version to use.
# Not used anymore -- see file debian/compat
# export DH_COMPAT=4

package         := w3c-dtd-xhtml

# directory abstraction
prefix          := debian/$(package)
#sgmldir         := $(prefix)/usr/share/sgml
xmldir          := $(prefix)/usr/share/xml
dtddir          := $(xmldir)/xhtml/schema/dtd/
docdir          := $(prefix)/usr/share/doc/$(package)
entdir          := $(xmldir)/entities/xhtml
# No configuration directory needed at the moment
#confdir         := $(prefix)/etc/sgml/$(package)

# tool abstraction
install_file    := install -o root -g root -m 644 -p
install_script  := install -o root -g root -m 755 -p
make_dir        := install -d -o root -g root -m 755
compress        := gzip -9f

# Nothing to do
configure:

# Nothing to do
build:

clean:
	dh_testdir
	dh_clean debian/catalog debian/conffiles debian/sgmlcatalogs

# Nothing to do
install: build

# Build architecture-independent files here.
binary-indep: build
	$(checkdir)
	dh_testroot

	$(make_dir) $(prefix)/DEBIAN $(dtddir) $(entdir)

	:> debian/sgmlcatalogs
#	:> debian/xmlcatalogs
	chmod a+x debian/sotoxml.pl
	$(SHELL) ./debian/install-dtds $(prefix)

	dh_installcatalogs -i
	dh_installxmlcatalogs -i

	dh_installdocs -i
	dh_installexamples -i examples/*
	dh_installchangelogs -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
# We have nothing to do by default.
binary-arch: build install

# We test for the most recent DTD in addition to testing for debian/rules
define checkdir
        test -f 1.1/DTD/xhtml11.dtd
        test -f debian/rules
endef

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