#
# Makefile for the Debian Subproject HOWTO
#

SRCS = subproject-howto.sgml

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

all: html txt ps

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

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 subproject-howto.sgml

html subproject-howto.html/index.html: $(SRCS)
	debiandoc2html $<

txt subproject-howto.txt: $(SRCS)
	debiandoc2text $<

ps subproject-howto.ps: $(SRCS)
	debiandoc2latexps $<

dvi subproject-howto.dvi: $(SRCS)
	debiandoc2latexdvi $<

pdf subproject-howto.pdf: $(SRCS)
	debiandoc2latexpdf $<

info subproject-howto.info: $(SRCS)
	debiandoc2info $<

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

.PHONY: all publish clean distclean validate
