DOCUMENT=arkitektur
IMAGE= network-arch
HTMLOPTS=--nochunks
GET_CHARSET=head -25 $(DOCUMENT).$*.po | grep "Content-Type" | sed -e "s/.*charset=\(.*\)/\1/" -e 's/\\\\n.//'
#
# HOWTO make changes to the documentation
# 1. make your changes in the $(DOCUMENT).en.sgml masterfile
# 2. run 'make master-update' to push the changes to the translators,
# and regenerate the english files
#
#
# HOWTO add a translation:
# 1. add a prerequisite for your langue to the "all" and "potfile" rules
# 2. run 'make $(DOCUMENT)..po' to create the initial .po file for the new language
# 3. translate the po file with the usual means
# 4. run 'make' to create the sgml, html, txt, ps, and pdf versions of your translation
#
#
# HOWTO (re)generate all files for a language:
# 1. run 'make CC-update' where CC is the language code
# (e.g. nl-update regenerates all arkitektur.nl.* files)
all: master-update da-update de-update nb-update nl-update pt_BR-update
# regenerate .pot file and merge changes into .po files
master-update: $(DOCUMENT).en.pot $(DOCUMENT).en.html $(DOCUMENT).en.txt $(DOCUMENT).en.ps $(DOCUMENT).en.pdf \
$(DOCUMENT).da.po $(DOCUMENT).de.po $(DOCUMENT).nb.po $(DOCUMENT).nl.po $(DOCUMENT).pt_BR.po
echo ;
# given the .po file generate all files for the language %
%-update:
make $(DOCUMENT).$*.po;
make $(DOCUMENT).$*.sgml
make $(DOCUMENT).$*.pdf;
-make $(DOCUMENT).$*.ps;
make $(IMAGE)_$*.png;
make $(DOCUMENT).$*.html;
make $(DOCUMENT).$*.txt
echo ;
#######################
# files for translation
#######################
$(DOCUMENT).en.pot: $(DOCUMENT).en.sgml
xml2pot $< > $@.new && mv $@.new $@
$(DOCUMENT).%.po: $(DOCUMENT).en.pot
if test -e $@; then msgmerge $@ $< | iconv -f utf-8 -t `$(GET_CHARSET)` > $@.new && cat $@.new | sed "s/charset=UTF-8/charset=`$(GET_CHARSET)`/" > $@; rm $@.new; else cp $< $@; fi;
#$(DOCUMENT).%.po: $(DOCUMENT).en.sgml $(DOCUMENT).%.sgml
# split2po $(DOCUMENT).en.sgml $(DOCUMENT).$*.sgml > $@.new && mv $@.new $@
#######################
# po->generated formats
#######################
# make sure we don't attempt to generate $(DOCUMENT).en.sgml
$(DOCUMENT).en.sgml: ;
$(DOCUMENT).%.sgml: $(DOCUMENT).%.po $(DOCUMENT).en.sgml
cat $< | iconv -f `$(GET_CHARSET)` -t utf-8 > tmp.po
po2xml $(DOCUMENT).en.sgml tmp.po | iconv -f utf-8 -t `$(GET_CHARSET)` | sed -e 's/lang="en"/lang="$*"/g' -e 's/_en/_$*/g'> $@
rm tmp.po
$(DOCUMENT).%.html: $(DOCUMENT).%.sgml $(IMAGE)_%.png
docbook2html -e no-valid $(DOCUMENT).$*.sgml $(HTMLOPTS)
if [ -n "$*" ]; then mv $(DOCUMENT).$*.html $(DOCUMENT).html.$*; fi
$(DOCUMENT).%.pdf: $(DOCUMENT).%.sgml $(IMAGE)_%.pdf
docbook2pdf -e no-valid $(DOCUMENT).$*.sgml
$(DOCUMENT).%.ps: $(DOCUMENT).%.sgml $(IMAGE)_%.eps
docbook2ps -e no-valid $(DOCUMENT).$*.sgml
$(DOCUMENT).%.txt: $(DOCUMENT).%.html
ln -s $(DOCUMENT).html.$* tmp.html;
w3m -dump tmp.html > $@;
rm tmp.html;
.SUFFIXES: .png .dia .eps .pdf
.eps.pdf:
epstopdf $<
.dia.eps:
dia --nosplash -e $@ $<
.dia.png:
dia --nosplash -e $@ $<
#########
# Cleanup
#########
# Temporary files and all generated formats
distclean: clean
$(RM) $(DOCUMENT).*.pdf $(DOCUMENT).*.ps $(DOCUMENT).html.* $(DOCUMENT).*.txt $(IMAGE)_*.png
en-distclean: clean
$(RM) $(DOCUMENT).$*.pdf $(DOCUMENT).$*.ps $(DOCUMENT).html.$* $(DOCUMENT).$*.txt $(IMAGE)_$*.png
%-distclean: clean
$(RM) $(DOCUMENT).$*.sgml $(DOCUMENT).$*.pdf $(DOCUMENT).$*.ps $(DOCUMENT).html.$* $(DOCUMENT).$*.txt $(IMAGE)_$*.png
# Only temporary files
clean:
$(RM) *.log *.aux *.bak *~ *.dvi *.new *.tex $(IMAGE)_*.pdf $(IMAGE)_*.eps