#
# Makefile for the Debian FAQ (Japanese)
#

SRCS = debian-faq.ja.sgml faqstatic.ja.ent faqdynamic.ja.ent $(wildcard *.sgml)

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

all: html txt

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

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

validate:
	nsgmls -ges -wall debian-faq.ja.sgml

html debian-faq.ja.html/index.html: $(SRCS)
	debiandoc2html -l ja $<

txt debian-faq.ja.txt: $(SRCS)
	debiandoc2text -l ja $<

ps debian-faq.ja.ps: $(SRCS)
	debiandoc2latexps $<

dvi debian-faq.ja.dvi: $(SRCS)
	debiandoc2latexdvi $<

pdf debian-faq.ja.pdf: $(SRCS)
	debiandoc2latexpdf $<

info debian-faq.ja.info: $(SRCS)
	debiandoc2info -l ja $<

clean distclean:
	rm -rf debian-faq.ja.html
	rm -f debian-faq.ja.{txt,ps,dvi,pdf,info*,aux,log,man,tex,toc,sasp*}
	rm -f faqdynamic.ja.ent *~ .*~ core tsa*

.PHONY: all publish clean distclean validate
