pkgdocdir=/usr/share/doc/gap-doc
INSTALL_SCRIPT = install -o root -g root -m 0755
INSTALL_DATA = install -o root -g root -m 0644
INSTALL_DIR = install -o root -g root -m 0644 -d

all: gap-policy.html/index.html gap-policy.txt gap.1
gap-policy.html/index.html: gap-policy.sgml
	debiandoc2html $<

gap-policy-one-file.html: gap-policy.sgml
	debiandoc2html -1 -b gap-policy-1-file $<
	mv gap-policy-1-file.html/index.html gap-policy-one-file.html
	rmdir gap-policy-1-file.html

gap-policy-one-file: gap-policy-one-file.html

gap.1: gap2man
	sh gap2man > gap.1.new && mv gap.1.new gap.1

%.info: %.sgml
	debiandoc2info $<

%.txt: %.sgml
	debiandoc2text -O $< > $@

%.gz:   %
	gzip --best --force --stdout $< > $@

clean:
	rm -f gap-policy.txt.gz

maintainer-clean:
	rm -rf gap-policy.html gap-policy.txt gap.1 gac.1

install: gap-policy.txt.gz gap-policy.html/index.html
	$(INSTALL_DIR)  $(DESTDIR)$(pkgdocdir)/gap-policy.html
	$(INSTALL_DATA) gap-policy.html/* $(DESTDIR)$(pkgdocdir)/gap-policy.html
	$(INSTALL_DATA) gap-policy.txt.gz $(DESTDIR)$(pkgdocdir)
	$(INSTALL_DATA) gap-policy.sgml $(DESTDIR)$(pkgdocdir)
	$(INSTALL_SCRIPT) gap2deb $(DESTDIR)$(pkgdocdir)
	
.PHONY: install maintainer-clean gap-policy-one-file
