#
# Makefile for the Debian Jr. Quick Guide
#

SRCS = junior-quickguide.sgml

# this can and will be overriden by a higher level makefile
PUBLISHDIR := ../../../public_html/junior-doc.html

all: html txt ps

publish: junior-quickguide.html/index.html
	test -d $(PUBLISHDIR)/junior-quickguide || install -d -m 755 $(PUBLISHDIR)/junior-quickguide
	rm -f $(PUBLISHDIR)/junior-quickguide/*.html
	install -p -m 644 junior-quickguide.html/*.html $(PUBLISHDIR)/junior-quickguide/

faqdynamic.ent:
	echo "<!entity docdate \"$(shell date +'%-d %B %Y')\">" > faqdynamic.ent
	if [ -f ../debian/changelog ]; then \
          echo "<!entity docversion \"` LC_ALL=C cd .. && dpkg-parsechangelog | grep '^Version: ' | sed 's/^Version: *//'`\">" >> faqdynamic.ent; \
        else \
          echo "<!entity docversion \"CVS\">" >> faqdynamic.ent; \
        fi

validate:
	nsgmls -ges -wall junior-quickguide.sgml

html junior-quickguide.html/index.html: $(SRCS)
	debiandoc2html $<

txt junior-quickguide.txt: $(SRCS)
	debiandoc2text $<

ps junior-quickguide.ps: $(SRCS)
	debiandoc2latexps $<

dvi junior-quickguide.dvi: $(SRCS)
	debiandoc2latexdvi $<

pdf junior-quickguide.pdf: $(SRCS)
	debiandoc2latexpdf $<

info junior-quickguide.info: $(SRCS)
	debiandoc2info $<

clean distclean:
	rm -rf junior-quickguide.html
	rm -f junior-quickguide.{txt,ps,dvi,pdf,info*,aux,log,man,tex,toc,sasp*}
	rm -f *~ .*~ core tsa*

.PHONY: all publish clean distclean validate
