1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
#
# Makefile for the Debian New Maintainers' Guide
#
# Should work both for a manual in the Debian Documentation Project
# manuals.sgml tree, and for $(MANUAL) package build.
# Build type: Possible values are BUILD_TYPE = web|package|...
BUILD_TYPE := web
# For DDP web build, we need to use woody machine.
ifeq ("$(BUILD_TYPE)", "web")
# temporary workaround until www-master updates debiandoc-sgml
export PATH:=../quick-reference/bin/:${PATH}
# Woodys default LaTeX settings need more memory for Korean PDF
export TEXMFCNF=../quick-reference/texmf:
# Osamu thinks Makefile dependence to the outside of package source
# tree is inherently risky. Thus these are intentionally excluded
# for the package build. But this is nessasary for woking around
# the current DDP CVS publish infrastructure.
endif
# Basename for SGML
MANUAL := $(shell echo $(notdir $(CURDIR)) | perl -pe 's/-[\d.]+$$//')
# this can and will be overriden by a higher level makefile
PUBLISHDIR := /org/www.debian.org/www/doc/manuals
all: html txt ps pdf
sources := $(wildcard *.??*.sgml)
sources_noncjk := $(sources)
# generating HTML
# ugly because the normal stuff works only as PHONYs. :(
#$(MANUAL).%.html/index.%.html: $(MANUAL).%.sgml
# debiandoc2html -c -l $* $<
html:
rm -rf *html
@if /usr/bin/test \( ! -e $(MANUAL).en.html/index.en.html \) -o \( $(MANUAL).sgml -nt $(MANUAL).en.html/index.en.html \); then \
echo debiandoc2html -c -l en $(MANUAL).sgml; \
debiandoc2html -c -l en $(MANUAL).sgml; \
mv $(MANUAL).html $(MANUAL).en.html; \
fi
@for i in *.??*.sgml; do \
j=$${i#$(MANUAL).}; lang=$${j%.sgml}; \
if /usr/bin/test \( ! -e $(MANUAL).$$lang.html/index.$$lang.html \) -o \( $$i -nt $(MANUAL).$$lang.html/index.$$lang.html \); then \
echo debiandoc2html -c -l $$lang $$i; \
debiandoc2html -c -l $$lang $$i; \
fi; \
done
# generating plain text
txt text: $(MANUAL).en.txt $(patsubst %.sgml,%.txt,$(sources))
$(MANUAL).en.txt: $(MANUAL).sgml
debiandoc2text -l en $<
mv $(MANUAL).txt $(MANUAL).en.txt
$(MANUAL).%.txt: $(MANUAL).%.sgml
debiandoc2text -l $* $<
# generating PostScript
ps: $(MANUAL).en.ps $(patsubst %.sgml,%.ps,$(sources_noncjk))
$(MANUAL).en.ps: $(MANUAL).sgml
debiandoc2latexps -l en $<
mv $(MANUAL).ps $(MANUAL).en.ps
$(MANUAL).%.ps: $(MANUAL).%.sgml
debiandoc2latexps -v -l $* $<
# generating Portable Document Format
pdf: $(MANUAL).en.pdf $(patsubst %.sgml,%.pdf,$(sources_noncjk))
$(MANUAL).en.pdf: $(MANUAL).sgml
debiandoc2latexpdf -l en $<
mv $(MANUAL).pdf $(MANUAL).en.pdf
$(MANUAL).%.pdf: $(MANUAL).%.sgml
debiandoc2latexpdf -l $* $<
# publishing to the DDP web pages
publish: all
test -d $(PUBLISHDIR)/$(MANUAL) || install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
rm -f $(PUBLISHDIR)/$(MANUAL)/*.html
install -p -m 644 $(MANUAL)*.html/*.html $(PUBLISHDIR)/$(MANUAL)/
# possible non-POSIX syntax below. fuck POSIX.
cd $(PUBLISHDIR)/$(MANUAL) && for file in *.en.html; do \
ln -s $$file $${file%$${file#$${file%.en.html}}}.html; \
done
install -p -m 644 $(MANUAL)*.txt $(MANUAL)*.ps $(MANUAL)*.pdf $(PUBLISHDIR)/$(MANUAL)
ln -sf $(MANUAL).en.txt $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).txt
ln -sf $(MANUAL).en.ps $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).ps
ln -sf $(MANUAL).en.pdf $(PUBLISHDIR)/$(MANUAL)/$(MANUAL).pdf
# validating SGML
validate:
@set -x; for i in $(wildcard *.sgml); do nsgmls -ges -wall $$i; done
# cleaning up
clean distclean:
-rm -f $(MANUAL)*.{txt,ps,dvi,pdf,info*,log,tex,aux,toc,out,sasp*,tpt,tex-in} *~
-rm -rf $(MANUAL)*.html
-rm -r *.tmp
ifeq ("$(BUILD_TYPE)", "web")
# remove artfacts from web
-rm -f $(MANUAL)
endif
.PHONY: all publish clean distclean validate
.SUFFIXES:
|