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

all: gap-policy.html/index.html gap-policy.txt
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 --no-name --force --stdout $< > $@

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

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

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)
	
.PHONY: install maintainer-clean gap-policy-one-file
