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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
####################################################################################
# Makefile for the Ubuntu Server Guide
# Copyright (C) 2011 Ubuntu Documentation Project (ubuntu-doc@lists.ubuntu.com)
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# On Debian based systems a copy of the GPL can be found
# at /usr/share/common-licenses/GPL
#
####################################################################################
MAKECMD=make
SED=/bin/sed
TMPDIR=/tmp/serverguide-build
# Language code for documents
# Ex. LN=ja for japanese
LN=C
# XSL Processors
XSLTPROC=/usr/bin/xsltproc
current_distro=$(shell test -e /etc/debian_version && echo "debian")
# Ubuntu Docbook Customization Layer
UBUNTUXSL=libs/ubuntu.xsl
UBUNTUPDFXSL=libs/ubuntu-pdf.xsl
# Base gnome directories for output from processor
BASE=build/
# Space-separated list of language codes for documents. HTML and or PDF will
# only be built for those codes in the list
# PO_FILES = ace ar ast be bg bn bs ca cs da de el en_AU en_CA en_GB eo es et eu fa fi fr gl gu he hr hu id is it ja km ko ku lo lt lv mk ms nb nl oc pl ps pt_BR pt ro ru sk sl sq sr sv th tl tr ug uk ur vi zh_CN zh_TW
# Why bother to have the above list? Why not just build it from the available .po files?
PO_FILES = $(basename $(notdir $(wildcard serverguide/po/*.po)))
clean:
rm -rf $(BASE)
## Targets for building standalone documents
serverguide-html:
# Builds the HTML files for the specified language codes.
# Specifiying the language in the final documents and
# performing some other necessary text replacements not handled by yelp-build.
# Language codes are normalized to IETF format, as opposed to glibc format
if [ $(LN) != "C" ]; then \
./scripts/translate.sh -d serverguide -l $(LN); \
fi
if find serverguide/$(LN) -name "serverguide.xml"; then \
mkdir -p $(BASE)serverguide/$(LN); \
lang=`echo $(LN) | $(SED) -e 's/[@_]/-/'`; \
if test "$$lang" = "C"; then lang=en; fi; \
if test "$$lang" = "gl"; then lang=gl-GL; fi; \
if test "$$lang" = "ms"; then lang=ms-MS; fi; \
if test "$$lang" = "pl"; then lang=pl-PL; fi; \
mkdir -p "$(TMPDIR)/$$lc"; \
$(SED) "s/#LANG#/$$lang/" $(UBUNTUXSL) > "$(TMPDIR)/ubuntu.xsl"; \
yelp-build html -o $(BASE)serverguide/$(LN) -x "$(TMPDIR)/ubuntu.xsl" serverguide/$(LN)/serverguide.xml; \
mkdir -p $(BASE)img; \
cp libs/img/* $(BASE)img/; \
$(SED) -i \
-e "s/<html>/<html lang="$$lang">/" \
$(BASE)serverguide/$(LN)/*.html."$$lang"; \
fi
serverguide-pdf:
if [ $(LN) != "C" ]; then \
./scripts/translate.sh -d serverguide -l $(LN); \
fi
if find serverguide/$(LN) -name "serverguide.xml"; then \
xsltproc --xinclude -o $(BASE)serverguide/$(LN)/serverguide.fo $(UBUNTUPDFXSL) serverguide/$(LN)/serverguide.xml; \
fop -fo $(BASE)serverguide/$(LN)/serverguide.fo -pdf $(BASE)serverguide/$(LN)/serverguide.pdf; \
fi
#
# Some multi langauage build routines
#
serverguide-lang-trans:
# Builds the translations for all non C languages.
$(foreach lingua, $(PO_FILES), ./scripts/translate.sh -d serverguide -l $(lingua);)
serverguide-lang-html:
# Builds the html serverguide for all non C languages.
# Prerequisite: serverguide-lang-trans
$(foreach lingua, $(PO_FILES), \
if find serverguide/$(lingua) -name "serverguide.xml"; then \
mkdir -p $(BASE)serverguide/$(lingua); \
lang=`echo $(lingua) | $(SED) -e 's/[@_]/-/'`; \
if test "$$lang" = "C"; then lang=en; fi; \
if test "$$lang" = "gl"; then lang=gl-GL; fi; \
if test "$$lang" = "ms"; then lang=ms-MS; fi; \
if test "$$lang" = "pl"; then lang=pl-PL; fi; \
mkdir -p "$(TMPDIR)/$$lc"; \
$(SED) "s/#LANG#/$$lang/" $(UBUNTUXSL) > "$(TMPDIR)/ubuntu.xsl"; \
yelp-build html -o $(BASE)serverguide/$(lingua) -x "$(TMPDIR)/ubuntu.xsl" serverguide/$(lingua)/serverguide.xml; \
$(SED) -i \
-e "s/<html>/<html lang="$$lang">/" \
$(BASE)serverguide/$(lingua)/*.html."$$lang"; \
fi;)
serverguide-lang-pdf:
# Builds the PDF serverguide for all non C languages.
# Prerequisite: serverguide-lang-trans
$(foreach lingua, $(PO_FILES), \
if find serverguide/$(lingua) -name "serverguide.xml"; then \
xsltproc --xinclude -o $(BASE)serverguide/$(lingua)/serverguide.fo $(UBUNTUPDFXSL) serverguide/$(lingua)/serverguide.xml; \
fop -fo $(BASE)serverguide/$(lingua)/serverguide.fo -pdf $(BASE)serverguide/$(lingua)/serverguide.pdf; \
fi;)
serverguide-lang-help:
# Builds a single directory of all languages html and PDF files, ready for possible copy and inclusion in the help.ubuntu.com branch
# Prerequisite: You must have already built the html and PDF's for all langauges, including the "C" ones.
# Notes: Currently .png files are actually identical for all languages, so why not use just one set of files.
# Currently .js files are actually identical for all languages, so why not use just one set of files.
# The .css files are no longer identical for all languages, so we need them all.
# Do not just copy the whole "C" directory or you will get the serverguuide.fo file, which you do not want.
# Language codes are normalized to IETF format, as opposed to glibc format.
# Does not create the ../../img directory, which is common across multiple releases. Local copy testing will need it.
rm -Rf $(BASE)help; \
mkdir -p $(BASE)help; \
cp $(BASE)serverguide/C/*.html.* $(BASE)help; \
cp $(BASE)serverguide/C/C.css $(BASE)help/en.css; \
cp $(BASE)serverguide/C/*.png $(BASE)help; \
cp $(BASE)serverguide/C/*.js $(BASE)help; \
cp $(BASE)serverguide/C/serverguide.pdf $(BASE)help/serverguide.pdf.en; \
$(SED) -i 's/href="C.css"/href="en.css"/' $(BASE)help/*.html.en; \
$(foreach lingua, $(PO_FILES), \
if find $(BASE)serverguide/$(lingua) -name "index.html.*"; then \
lang=`echo $(lingua) | $(SED) -e 's/[@_]/-/'`; \
if test "$$lang" = "gl"; then lang=gl-GL; fi; \
if test "$$lang" = "ms"; then lang=ms-MS; fi; \
if test "$$lang" = "pl"; then lang=pl-PL; fi; \
cp $(BASE)serverguide/$(lingua)/*.html."$$lang" $(BASE)help; \
cp $(BASE)serverguide/$(lingua)/serverguide.pdf $(BASE)help/serverguide.pdf."$$lang"; \
cp $(BASE)serverguide/$(lingua)/C.css $(BASE)help/$(lingua).css; \
$(SED) -i 's/href="C.css"/href="$(lingua).css"/' $(BASE)help/*.html."$$lang"; \
fi;)
serverguide-lang-trans-clean:
# For now, remove tanslations directores, if they are there. For future, they shouldn't be built here in the first place as then they appear in the BZR unknown list.
# Using both the presence check and the rm force option is redundant, but whatever.
$(foreach lingua, $(PO_FILES), \
if find serverguide/$(lingua) -name "serverguide.xml"; then \
rm -rf serverguide/$(lingua); \
fi;)
|