#
# Makefile for the Debian New Maintainers' Guide
#
# Should work both for a manual in the Debian Documentation Project
# manuals.sgml tree, and for  package build.

# this can and will be overriden by a higher level makefile
PUBLISHDIR := $(DESTDIR)/usr/share/doc/euro-support/

install: publish
all: sgml html txt ps pdf


# borrowed from the  java-common packages
sgml: debian-euro-support.sgml
debian-euro-support.sgml: 
	(cvs -d :pserver:anonymous@cvs.debian.org:/cvs/debian-doc -z3 checkout -d DOC ddp/manuals.sgml/euro-support/debian-euro-support.sgml; mv DOC/debian-euro-support.sgml .; rm -rf DOC)

# generating HTML
html: debian-euro-support.html/index.html
debian-euro-support.html/index.html: debian-euro-support.sgml
	debiandoc2html -l en $<

# generating plain text
txt text: debian-euro-support.txt

%.txt: %.sgml
	debiandoc2text -l en $<

# generating PostScript
ps: debian-euro-support.ps

%.ps: %.sgml
	debiandoc2latexps  -l en $<

pdf: debian-euro-support.pdf
%.pdf: %.ps
	ps2pdf $< 

# publishing to the DDP web pages
publish: all
	test -d $(PUBLISHDIR)/ || install -d -m 755 $(PUBLISHDIR)/debian-euro-support
	rm -f $(PUBLISHDIR)//*.html
	mkdir $(PUBLISHDIR)//debian-euro-support.html/
	install -p -m 644 *.html/*.html $(PUBLISHDIR)//debian-euro-support.html/
	install -p -m 644 *.{txt,ps,sgml} $(PUBLISHDIR)/

# validating SGML
validate:
	set -x; for i in $(wildcard *.sgml); do nsgmls -ges -wall $$i; done

# cleaning up
clean distclean:
	rm -f *.{txt,ps,dvi,pdf,info*,log,tex,aux,toc,sasp*} *~
	rm -rf *.html 
	rm -f debian-euro-support.sgml 

.PHONY: all publish clean distclean validate 
