| 1 |
#
|
| 2 |
# Standard Debian Documentation Project Makefile
|
| 3 |
#
|
| 4 |
# Should work both for a manual in the DDP CVS tree, and for a package build.
|
| 5 |
|
| 6 |
export PATH:=../quick-reference/bin/:${PATH}
|
| 7 |
|
| 8 |
# Basename for SGML
|
| 9 |
MANUAL := $(notdir $(CURDIR))
|
| 10 |
|
| 11 |
# this can and will be overriden by a higher level makefile
|
| 12 |
PUBLISHDIR := /org/www.debian.org/www/doc/manuals
|
| 13 |
|
| 14 |
all: html txt ps pdf
|
| 15 |
|
| 16 |
# generating HTML
|
| 17 |
# ugly because the normal stuff works only as PHONYs. :(
|
| 18 |
#$(MANUAL).%.html/index.%.html: $(MANUAL).%.sgml
|
| 19 |
# debiandoc2html -c -l $* $<
|
| 20 |
html:
|
| 21 |
@for i in *.??*.sgml; do \
|
| 22 |
j=$${i#$(MANUAL).}; lang=$${j%.sgml}; \
|
| 23 |
langfoo=`echo $$lang | tr 'A-Z_' 'a-z-'`; \
|
| 24 |
if [ $$i -nt $(MANUAL).$$lang.html/index.$$langfoo.html ]; then \
|
| 25 |
echo debiandoc2html -c -l $$lang $$i "($$langfoo)"; \
|
| 26 |
debiandoc2html -c -l $$lang $$i; \
|
| 27 |
fi; \
|
| 28 |
done
|
| 29 |
|
| 30 |
# generating plain text
|
| 31 |
txt text: $(patsubst %.sgml,%.txt,$(wildcard *.??*.sgml))
|
| 32 |
|
| 33 |
$(MANUAL).%.txt: $(MANUAL).%.sgml
|
| 34 |
debiandoc2text -l $* $<
|
| 35 |
|
| 36 |
# generating PostScript
|
| 37 |
texfriendly := $(filter-out $(MANUAL).ko.sgml,$(wildcard *.??*.sgml))
|
| 38 |
ps: $(patsubst %.sgml,%.ps,$(texfriendly))
|
| 39 |
|
| 40 |
$(MANUAL).%.ps: $(MANUAL).%.sgml
|
| 41 |
debiandoc2latexps -l $* $<
|
| 42 |
|
| 43 |
# generating Portable Document Format
|
| 44 |
pdf: $(patsubst %.sgml,%.pdf,$(texfriendly))
|
| 45 |
|
| 46 |
$(MANUAL).%.pdf: $(MANUAL).%.sgml
|
| 47 |
debiandoc2latexpdf -l $* $<
|
| 48 |
|
| 49 |
# publishing to the DDP web pages
|
| 50 |
publish: all
|
| 51 |
test -d $(PUBLISHDIR)/$(MANUAL) || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 52 |
rm -f $(PUBLISHDIR)/$(MANUAL)/*.html
|
| 53 |
install -p -m 644 $(MANUAL)*.html/*.html $(PUBLISHDIR)/$(MANUAL)/
|
| 54 |
# possible non-POSIX syntax below. fuck POSIX.
|
| 55 |
cd $(PUBLISHDIR)/$(MANUAL) && for file in *.en.html; do \
|
| 56 |
ln -s $$file $${file%$${file#$${file%.en.html}}}.html; \
|
| 57 |
done
|
| 58 |
install -p -m 644 $(MANUAL)*.txt $(MANUAL)*.ps $(MANUAL)*.pdf $(PUBLISHDIR)/$(MANUAL)
|
| 59 |
ln -sf $(MANUAL).en.txt $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).txt
|
| 60 |
ln -sf $(MANUAL).en.ps $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).ps
|
| 61 |
ln -sf $(MANUAL).en.pdf $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).pdf
|
| 62 |
|
| 63 |
# validating SGML
|
| 64 |
validate:
|
| 65 |
@set -x; for i in $(wildcard *.sgml); do nsgmls -ges -wall $$i; done
|
| 66 |
|
| 67 |
# cleaning up
|
| 68 |
clean distclean:
|
| 69 |
rm -f $(MANUAL)*.{txt,ps,dvi,pdf,info*,log,tex,aux,toc,out,sasp*} *~
|
| 70 |
rm -rf $(MANUAL)*.html
|
| 71 |
|
| 72 |
.PHONY: all publish clean distclean validate
|
| 73 |
.SUFFIXES:
|