| 1 |
jfs |
1230 |
#
|
| 2 |
jfs |
2535 |
# Based Makefile Template from Osamu Aoki
|
| 3 |
jfs |
1230 |
#
|
| 4 |
jfs |
2535 |
# Build html(multi-page), txt, ps, pdf, and other formats.
|
| 5 |
|
|
#
|
| 6 |
jfs |
1230 |
# Should work both for a manual in the Debian Documentation Project
|
| 7 |
joy |
1735 |
# manuals.sgml tree, and for the package build.
|
| 8 |
jfs |
2535 |
# ------------------------------------------------------------------- #
|
| 9 |
|
|
# WARNING #
|
| 10 |
|
|
# Use with caution, aimed at Woody system #
|
| 11 |
|
|
# "ps" and "pdf" tends to break in some ill-configured systems #
|
| 12 |
|
|
# ------------------------------------------------------------------- #
|
| 13 |
|
|
# Read local texmf.cnf file
|
| 14 |
jfs |
1067 |
|
| 15 |
jseidel |
2937 |
.SUFFIXES:
|
| 16 |
|
|
|
| 17 |
jfs |
2535 |
# Following default shall be edited by the coordinator for the entire
|
| 18 |
|
|
# set of languages. If a subsection owner wishes to override settings,
|
| 19 |
|
|
# they can be overridden by running make with "make 'LANGS1=fi'" etc..
|
| 20 |
jfs |
1067 |
|
| 21 |
jfs |
2535 |
# =================================================================== #
|
| 22 |
|
|
# Default configuration part: Customize #
|
| 23 |
|
|
# =================================================================== #
|
| 24 |
opal |
1666 |
|
| 25 |
jfs |
2535 |
# The directory in which this makefile resides must also contain a file
|
| 26 |
|
|
# called <directoryname>.[<language>.]sgml, which is the top-level file
|
| 27 |
|
|
# for the manual in this directory.
|
| 28 |
jfs |
1067 |
|
| 29 |
jfs |
2535 |
# Basename for language-dependent SGML (DDP default, generated)
|
| 30 |
|
|
MANUAL := securing-debian-howto
|
| 31 |
jfs |
1067 |
|
| 32 |
jfs |
2535 |
# Basename for language-independent SGML-template.
|
| 33 |
|
|
MANUAL0 := $(MANUAL)
|
| 34 |
jfs |
1067 |
|
| 35 |
jfs |
2535 |
# Build type: Possible values are BUILD_TYPE = web|package
|
| 36 |
|
|
BUILD_TYPE := web
|
| 37 |
jfs |
1230 |
|
| 38 |
jfs |
2535 |
# Publish directory
|
| 39 |
|
|
# This can and will be overridden by a higher level makefile
|
| 40 |
|
|
PUBLISHDIR := ~/public_html/manuals.html
|
| 41 |
jfs |
1230 |
|
| 42 |
jfs |
2535 |
# List of languages built for "distclean" target for DDP:
|
| 43 |
jfs |
2909 |
LANGSALL := en de fr es it ru ja zh-cn
|
| 44 |
jfs |
2535 |
# List of languages built for "publish" target for DDP
|
| 45 |
jfs |
3567 |
LANGS := en de fr
|
| 46 |
|
|
# This are all the languages, not all are compiled for DDP
|
| 47 |
|
|
# due to them being out of dte
|
| 48 |
|
|
#LANGS := en de fr es it ru ja zh-cn
|
| 49 |
jfs |
1230 |
|
| 50 |
jfs |
2535 |
# Files which affect SGML generation (excluding *.sgml)
|
| 51 |
|
|
SGMLENTS := custom.ent default.ent
|
| 52 |
jfs |
1230 |
|
| 53 |
jfs |
2535 |
# All SGML source files
|
| 54 |
|
|
SGMLSRCS := $(foreach lang, $(LANGS), $(MANUAL).$(lang).sgml) \
|
| 55 |
|
|
$(foreach lang, $(LANGS), $(wildcard $(lang)/*.sgml ) ) \
|
| 56 |
|
|
$(SGMLENTS)
|
| 57 |
jfs |
1230 |
|
| 58 |
jfs |
2535 |
# =================================================================== #
|
| 59 |
|
|
# Build target default part: Routine #
|
| 60 |
|
|
# =================================================================== #
|
| 61 |
|
|
# If some languages have problems building, filter-out in here.
|
| 62 |
jfs |
1230 |
|
| 63 |
jseidel |
2949 |
# define $(locale) for the following targets
|
| 64 |
|
|
$(MANUAL).%.html.stamp $(MANUAL).%.txt $(MANUAL).%.ps $(MANUAL).%.pdf: \
|
| 65 |
|
|
locale=$(subst pt-br,pt_BR,\
|
| 66 |
|
|
$(subst zh-cn,zh_CN,\
|
| 67 |
|
|
$*))
|
| 68 |
|
|
|
| 69 |
jfs |
2535 |
### Full guide
|
| 70 |
jfs |
1230 |
|
| 71 |
jfs |
2535 |
# List of html stamp files to be built
|
| 72 |
|
|
HTMLS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).html.stamp)
|
| 73 |
jfs |
1230 |
|
| 74 |
jfs |
2711 |
# List of txt to be built
|
| 75 |
jfs |
2535 |
TXTS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).txt)
|
| 76 |
jfs |
1230 |
|
| 77 |
jfs |
2535 |
# List of ps to be built
|
| 78 |
|
|
PSS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).ps)
|
| 79 |
jfs |
1230 |
|
| 80 |
jfs |
2535 |
# List of pdf to be built
|
| 81 |
|
|
PDFS := $(foreach lang,$(LANGS),$(MANUAL).$(lang).pdf)
|
| 82 |
jfs |
1230 |
|
| 83 |
|
|
|
| 84 |
jfs |
2535 |
# =================================================================== #
|
| 85 |
|
|
# Build target part: Customize #
|
| 86 |
|
|
# =================================================================== #
|
| 87 |
|
|
# If some languages have problems building, filter-out in here.
|
| 88 |
jfs |
1230 |
|
| 89 |
jseidel |
2735 |
all: html txt ps pdf
|
| 90 |
jfs |
2535 |
html: $(HTMLS)
|
| 91 |
|
|
text txt: $(TXTS)
|
| 92 |
|
|
ps: $(PSS)
|
| 93 |
|
|
pdf: $(PDFS)
|
| 94 |
jfs |
1230 |
|
| 95 |
jseidel |
2749 |
publish: publish-html publish-txt publish-ps publish-pdf
|
| 96 |
jfs |
1230 |
|
| 97 |
jfs |
2535 |
# =================================================================== #
|
| 98 |
|
|
# Build rule part: If not package build #
|
| 99 |
|
|
# =================================================================== #
|
| 100 |
|
|
|
| 101 |
|
|
$(MANUAL).%.ent:
|
| 102 |
|
|
echo "<!ENTITY language \"$*\">" > $@
|
| 103 |
|
|
echo "<!ENTITY % lang-$* \"INCLUDE\">" >> $@
|
| 104 |
|
|
echo "<!ENTITY docdate \"`LC_ALL=C date -R`\">" >> $@
|
| 105 |
|
|
echo "<!ENTITY docversion \"CVS\">" >> $@
|
| 106 |
|
|
|
| 107 |
|
|
|
| 108 |
|
|
# =================================================================== #
|
| 109 |
|
|
# Build rule part: Routine #
|
| 110 |
|
|
# =================================================================== #
|
| 111 |
|
|
|
| 112 |
|
|
# SGML
|
| 113 |
|
|
|
| 114 |
|
|
# Create starting SGML for each language from the template. Actual
|
| 115 |
|
|
# contents reside in language-segregated subdirectories.
|
| 116 |
|
|
|
| 117 |
|
|
$(MANUAL).%.sgml: $(MANUAL0).sgml
|
| 118 |
|
|
sed -e "s/@@LANGS@@/$*/g" \
|
| 119 |
|
|
-e "s/@@DIRS@@/$*/g" \
|
| 120 |
|
|
-e "s/@@NAME@@/$(MANUAL)/g" \
|
| 121 |
|
|
$< > $(MANUAL).$*.sgml
|
| 122 |
|
|
|
| 123 |
|
|
# HTML
|
| 124 |
jseidel |
2821 |
$(MANUAL).%.html.stamp: $(MANUAL).%.sgml $(MANUAL).%.ent $(SGMLSRCS)
|
| 125 |
jseidel |
2949 |
debiandoc2html -l $(locale) -c $<
|
| 126 |
jfs |
2535 |
# since $(MANUAL).%.html/index.%.html cannot be a target file
|
| 127 |
jseidel |
3671 |
@for file in `ls $(MANUAL).$*.html/*` ; do \
|
| 128 |
jfs |
2535 |
newfile=`echo $$file|\
|
| 129 |
|
|
sed 's/$(shell echo $*|\
|
| 130 |
|
|
sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ_/abcdefghijklmnopqrstuvwxyz-/'\
|
| 131 |
jseidel |
3671 |
)\.html/$*\.html/'`; \
|
| 132 |
|
|
if [ $$file != $$newfile ] ; then \
|
| 133 |
|
|
mv $$file $$newfile; \
|
| 134 |
|
|
echo "Rename $$file --> $$newfile"; \
|
| 135 |
|
|
fi \
|
| 136 |
jfs |
2535 |
done
|
| 137 |
|
|
touch $(MANUAL).$*.html.stamp
|
| 138 |
|
|
|
| 139 |
|
|
# TXT
|
| 140 |
|
|
|
| 141 |
|
|
$(MANUAL).%.txt: $(MANUAL).%.sgml $(MANUAL).%.ent $(SGMLSRCS)
|
| 142 |
jseidel |
2949 |
debiandoc2text -l $(locale) $<
|
| 143 |
jfs |
2535 |
|
| 144 |
|
|
|
| 145 |
|
|
# PS
|
| 146 |
|
|
|
| 147 |
|
|
$(MANUAL).%.ps: $(MANUAL).%.sgml $(MANUAL).%.ent $(SGMLSRCS)
|
| 148 |
jseidel |
2949 |
debiandoc2latexps -l $(locale) $<
|
| 149 |
jfs |
2535 |
|
| 150 |
|
|
# PDF
|
| 151 |
|
|
|
| 152 |
|
|
$(MANUAL).%.pdf: $(MANUAL).%.sgml $(MANUAL).%.ent $(SGMLSRCS)
|
| 153 |
jseidel |
2949 |
debiandoc2latexpdf -l $(locale) $<
|
| 154 |
jfs |
1230 |
|
| 155 |
|
|
|
| 156 |
jfs |
2535 |
# =================================================================== #
|
| 157 |
|
|
# Build rule part: Web publish #
|
| 158 |
|
|
# =================================================================== #
|
| 159 |
|
|
|
| 160 |
|
|
publish-html: html
|
| 161 |
jfs |
1230 |
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 162 |
|
|
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 163 |
|
|
rm -f $(PUBLISHDIR)/$(MANUAL)/*.html
|
| 164 |
jfs |
2535 |
# install all html
|
| 165 |
jfs |
2807 |
$(foreach lang,$(LANGS),\
|
| 166 |
jfs |
2535 |
install -p -m 644 $(MANUAL).$(lang).html/*.html \
|
| 167 |
|
|
$(PUBLISHDIR)/$(MANUAL)/ ;\
|
| 168 |
|
|
)
|
| 169 |
|
|
publish-txt: txt
|
| 170 |
|
|
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 171 |
|
|
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 172 |
|
|
rm -f $(PUBLISHDIR)/$(MANUAL)/*.txt
|
| 173 |
|
|
# install all txt
|
| 174 |
|
|
@$(foreach lang,$(LANGS),\
|
| 175 |
|
|
install -p -m 644 $(MANUAL).$(lang).txt \
|
| 176 |
|
|
$(PUBLISHDIR)/$(MANUAL)/ ;\
|
| 177 |
|
|
)
|
| 178 |
jfs |
1230 |
|
| 179 |
jfs |
2535 |
publish-ps: ps
|
| 180 |
jfs |
1230 |
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 181 |
|
|
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 182 |
jfs |
2535 |
rm -f $(PUBLISHDIR)/$(MANUAL)/*.ps
|
| 183 |
|
|
# install all ps
|
| 184 |
|
|
@$(foreach lang,$(LANGS),\
|
| 185 |
|
|
install -p -m 644 $(MANUAL).$(lang).ps \
|
| 186 |
|
|
$(PUBLISHDIR)/$(MANUAL)/ ;\
|
| 187 |
jfs |
1230 |
)
|
| 188 |
|
|
|
| 189 |
|
|
|
| 190 |
jfs |
2535 |
publish-pdf: pdf
|
| 191 |
jfs |
1230 |
test -d $(PUBLISHDIR)/$(MANUAL) \
|
| 192 |
|
|
|| install -d -m 755 $(PUBLISHDIR)/$(MANUAL)
|
| 193 |
jfs |
2535 |
rm -f $(PUBLISHDIR)/$(MANUAL)/*.pdf
|
| 194 |
|
|
# install all pdf1
|
| 195 |
|
|
@$(foreach lang,$(LANGS),\
|
| 196 |
|
|
install -p -m 644 $(MANUAL).$(lang).pdf \
|
| 197 |
|
|
$(PUBLISHDIR)/$(MANUAL)/ ;\
|
| 198 |
|
|
)
|
| 199 |
jfs |
1230 |
|
| 200 |
|
|
|
| 201 |
|
|
#====[ validating SGML ]=======================================================
|
| 202 |
jfs |
1067 |
validate:
|
| 203 |
jfs |
2535 |
set -x; for i in $(LANGS); do $(MAKE) validate1-$$i ; done
|
| 204 |
jfs |
1067 |
|
| 205 |
jfs |
2535 |
validate1-%: $(SGMLSRCS) $(MANUAL)-%.ent
|
| 206 |
|
|
nsgmls -gues -wall $(MANUAL)-$*.sgml
|
| 207 |
|
|
|
| 208 |
|
|
|
| 209 |
jfs |
1230 |
#====[ cleaning up ]===========================================================
|
| 210 |
jfs |
2535 |
distclean: clean
|
| 211 |
|
|
rm -Rf $(PUBLISHDIR)/$(MANUAL)
|
| 212 |
|
|
rm -f *.error $(MANUAL).*.sgml
|
| 213 |
jfs |
1067 |
|
| 214 |
jfs |
2535 |
clean:
|
| 215 |
|
|
rm -f $(MANUAL)*.{txt,ps,dvi,pdf,info*,log,tex,aux,toc,sasp*,out,tov}
|
| 216 |
|
|
rm -f *~ prior.aux pprior.aux tar.gz.log
|
| 217 |
jfs |
2816 |
rm -f *.error $(MANUAL).*.ent $(MANUAL).*.sgml date.ent $(MANUAL).*.tpt
|
| 218 |
jfs |
2535 |
rm -rf $(MANUAL)*.html *stamp
|
| 219 |
|
|
|
| 220 |
|
|
.PHONY: all html text txt ps pdf \
|
| 221 |
|
|
publish publish-html publish-tst publish-ps publish-pdf \
|
| 222 |
jfs |
1230 |
clean distclean validate
|
| 223 |
jfs |
2535 |
|