| 1 |
#
|
| 2 |
# Makefile for the Debian History
|
| 3 |
#
|
| 4 |
# Should work both for a manual in the Debian Documentation Project
|
| 5 |
# manuals.sgml tree, and for $(MANUAL) package build.
|
| 6 |
|
| 7 |
# Basename for SGML
|
| 8 |
MANUAL := project-history
|
| 9 |
|
| 10 |
# this can and will be overriden by a higher level makefile
|
| 11 |
PUBLISHDIR := /org/www.debian.org/www/doc/manuals
|
| 12 |
|
| 13 |
all: html txt ps pdf
|
| 14 |
|
| 15 |
po-sources := $(wildcard *.??*.po)
|
| 16 |
sgml-from-po := $(patsubst %.po,%.sgml,$(po-sources))
|
| 17 |
sgml-sources := $(wildcard *.??*.sgml)
|
| 18 |
sources := $(sgml-sources) $(sgml-from-po)
|
| 19 |
sources_noncjk := $(sources)
|
| 20 |
|
| 21 |
$(MANUAL).pot: $(MANUAL).sgml
|
| 22 |
debiandoc2pot $(MANUAL).sgml > $(MANUAL).pot
|
| 23 |
|
| 24 |
$(MANUAL).%.sgml: $(MANUAL).sgml $(MANUAL).%.po
|
| 25 |
po2debiandoc $(MANUAL).sgml $(MANUAL).$*.po > $(MANUAL).$*.sgml
|
| 26 |
|
| 27 |
update-po: $(MANUAL).pot
|
| 28 |
for po in $(po-sources); do \
|
| 29 |
msgmerge --width=76 $$po $(MANUAL).pot -o $$po.new && mv $$po.new $$po; \
|
| 30 |
done
|
| 31 |
|
| 32 |
# generating HTML
|
| 33 |
# ugly because the normal stuff works only as PHONYs. :(
|
| 34 |
#$(MANUAL).%.html/index.%.html: $(MANUAL).%.sgml
|
| 35 |
# debiandoc2html -c -l $* $<
|
| 36 |
html:
|
| 37 |
@if [ $(MANUAL).sgml -nt $(MANUAL).en.html/index.en.html ]; then \
|
| 38 |
rm -r $(MANUAL).en.html; \
|
| 39 |
echo debiandoc2html -c -l en $(MANUAL).sgml; \
|
| 40 |
debiandoc2html -c -l en $(MANUAL).sgml; \
|
| 41 |
mv $(MANUAL).html $(MANUAL).en.html; \
|
| 42 |
fi
|
| 43 |
@for i in $(sgml-sources) $(po-sources); do \
|
| 44 |
nosuffix1=$${i%.sgml}; nosuffix=$${nosuffix1%.po}; \
|
| 45 |
lang=$${nosuffix#$(MANUAL).}; \
|
| 46 |
if [ $$i -nt $(MANUAL).$$lang.html/index.$$lang.html ]; then \
|
| 47 |
sgmlfile=$$nosuffix.sgml; \
|
| 48 |
[ $$sgmlfile != $$i ] && make $$sgmlfile; \
|
| 49 |
echo debiandoc2html -c -l $$lang $$sgmlfile; \
|
| 50 |
debiandoc2html -c -l $$lang $$sgmlfile; \
|
| 51 |
fi; \
|
| 52 |
done
|
| 53 |
|
| 54 |
# generating plain text
|
| 55 |
txt text: $(MANUAL).en.txt $(patsubst %.sgml,%.txt,$(sources))
|
| 56 |
|
| 57 |
$(MANUAL).en.txt: $(MANUAL).sgml
|
| 58 |
debiandoc2text -l en $<
|
| 59 |
mv $(MANUAL).txt $(MANUAL).en.txt
|
| 60 |
|
| 61 |
$(MANUAL).%.txt: $(MANUAL).%.sgml
|
| 62 |
debiandoc2text -l $* $<
|
| 63 |
|
| 64 |
# generating PostScript
|
| 65 |
ps: $(MANUAL).en.ps $(patsubst %.sgml,%.ps,$(sources_noncjk))
|
| 66 |
|
| 67 |
$(MANUAL).en.ps: $(MANUAL).sgml
|
| 68 |
debiandoc2latexps -l en $<
|
| 69 |
mv $(MANUAL).ps $(MANUAL).en.ps
|
| 70 |
|
| 71 |
$(MANUAL).%.ps: $(MANUAL).%.sgml
|
| 72 |
debiandoc2latexps -l $* $<
|
| 73 |
|
| 74 |
# generating Portable Document Format
|
| 75 |
pdf: $(MANUAL).en.pdf $(patsubst %.sgml,%.pdf,$(sources_noncjk))
|
| 76 |
|
| 77 |
$(MANUAL).en.pdf: $(MANUAL).sgml
|
| 78 |
debiandoc2latexpdf -l en $<
|
| 79 |
mv $(MANUAL).pdf $(MANUAL).en.pdf
|
| 80 |
|
| 81 |
$(MANUAL).%.pdf: $(MANUAL).%.sgml
|
| 82 |
debiandoc2latexpdf -l $* $<
|
| 83 |
|
| 84 |
# publishing to the DDP web pages
|
| 85 |
publish: all
|
| 86 |
test -d $(PUBLISHDIR)/$(MANUAL) || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 87 |
rm -f $(PUBLISHDIR)/$(MANUAL)/*.html
|
| 88 |
install -p -m 644 $(MANUAL)*.html/*.html $(PUBLISHDIR)/$(MANUAL)/
|
| 89 |
# possible non-POSIX syntax below.
|
| 90 |
cd $(PUBLISHDIR)/$(MANUAL) && for file in *.en.html; do \
|
| 91 |
ln -s $$file $${file%$${file#$${file%.en.html}}}.html; \
|
| 92 |
done
|
| 93 |
install -p -m 644 $(MANUAL)*.txt $(MANUAL)*.ps $(MANUAL)*.pdf $(PUBLISHDIR)/$(MANUAL)
|
| 94 |
ln -sf $(MANUAL).en.txt $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).txt
|
| 95 |
ln -sf $(MANUAL).en.ps $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).ps
|
| 96 |
ln -sf $(MANUAL).en.pdf $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).pdf
|
| 97 |
|
| 98 |
# validating SGML
|
| 99 |
validate:
|
| 100 |
@set -x; for i in $(wildcard *.sgml); do nsgmls -ges -wall $$i; done
|
| 101 |
|
| 102 |
# cleaning up
|
| 103 |
clean distclean:
|
| 104 |
for suffix in txt ps dvi pdf info* log tex aux toc out sasp* tpt; do \
|
| 105 |
rm -f $(MANUAL)*.$$suffix; \
|
| 106 |
done
|
| 107 |
rm -rf $(MANUAL)*.html head.tmp body.tmp *~ $(sgml-from-po)
|
| 108 |
|
| 109 |
.PHONY: all publish clean distclean validate
|
| 110 |
.SUFFIXES:
|