Merge lp:~dsmythies/serverguide/makefile_changes into lp:~ubuntu-core-doc/serverguide/saucy

Proposed by Doug Smythies
Status: Merged
Merged at revision: 163
Proposed branch: lp:~dsmythies/serverguide/makefile_changes
Merge into: lp:~ubuntu-core-doc/serverguide/saucy
Diff against target: 130 lines (+92/-7)
1 file modified
Makefile (+92/-7)
To merge this branch: bzr merge lp:~dsmythies/serverguide/makefile_changes
Reviewer Review Type Date Requested Status
Benjamin Kerensa (community) Approve
Review via email: mp+183363@code.launchpad.net

Description of the change

Makefile changes and expansion so that all languages can be done in bulk.
Also includes another option to copy and change files for possible inclusion on help.ubuntu.com
I find Makefile and SED file syntax very finicky and this took me a very very long time to get working properly.

Review by another "doc committer" is desired.

I seem to have used the local name "makefile_changes" before, so I hope that doesn't cause any grief.

To post a comment you must log in.
Revision history for this message
Doug Smythies (dsmythies) wrote :

In the absence of any other review, I'll just merge this myself in about 24 hours.

Revision history for this message
Peter Matulis (petermatulis) wrote :

I don't know enough about this stuff to provide a valuable review.

Revision history for this message
Benjamin Kerensa (bkerensa) wrote :

Looks good to me.

review: Approve
Revision history for this message
Doug Smythies (dsmythies) wrote :

Thanks. As mentioned on the e-mail threads and in my post above, I was just going to push this myself. I just hadn't got around to it. I appreciate the peer review.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2013-05-28 22:13:27 +0000
+++ Makefile 2013-09-01 18:10:20 +0000
@@ -42,6 +42,12 @@
42# Base gnome directories for output from processor42# Base gnome directories for output from processor
43BASE=build/43BASE=build/
4444
45# Space-separated list of language codes for documents. HTML and or PDF will
46# only be built for those codes in the list
47# 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
48# Why bother to have the above list? Why not just build it from the available .po files?
49PO_FILES = $(basename $(notdir $(wildcard serverguide/po/*.po)))
50
45clean:51clean:
46 rm -rf $(BASE)52 rm -rf $(BASE)
4753
@@ -57,11 +63,11 @@
57 if [ $(LN) != "C" ]; then \63 if [ $(LN) != "C" ]; then \
58 ./scripts/translate.sh -d serverguide -l $(LN); \64 ./scripts/translate.sh -d serverguide -l $(LN); \
59 fi65 fi
60 if find serverguide/$(LN) -name "*.xml"; then \66 if find serverguide/$(LN) -name "serverguide.xml"; then \
61 mkdir -p build/serverguide/$(LN); \67 mkdir -p $(BASE)serverguide/$(LN); \
62 yelp-build html -o build/serverguide/$(LN) -x $(UBUNTUXSL) serverguide/$(LN)/serverguide.xml; \68 yelp-build html -o $(BASE)serverguide/$(LN) -x $(UBUNTUXSL) serverguide/$(LN)/serverguide.xml; \
63 mkdir -p build/img; \69 mkdir -p $(BASE)img; \
64 cp libs/img/* build/img/; \70 cp libs/img/* $(BASE)img/; \
65 lang=`echo $(LN) | $(SED) -e 's/[@_]/-/'`; \71 lang=`echo $(LN) | $(SED) -e 's/[@_]/-/'`; \
66 if test "$$lang" = "C"; then lang=en; fi; \72 if test "$$lang" = "C"; then lang=en; fi; \
67 if test "$$lang" = "gl"; then lang=gl-GL; fi; \73 if test "$$lang" = "gl"; then lang=gl-GL; fi; \
@@ -70,7 +76,7 @@
70 $(SED) -i \76 $(SED) -i \
71 -e '1s/^/<!DOCTYPE html\>\n/' \77 -e '1s/^/<!DOCTYPE html\>\n/' \
72 -e "s/<html>/<html lang="$$lang">/" \78 -e "s/<html>/<html lang="$$lang">/" \
73 build/serverguide/$(LN)/*.html; \79 $(BASE)serverguide/$(LN)/*.html; \
74 fi80 fi
7581
76serverguide-pdf:82serverguide-pdf:
@@ -78,7 +84,86 @@
78 if [ $(LN) != "C" ]; then \84 if [ $(LN) != "C" ]; then \
79 ./scripts/translate.sh -d serverguide -l $(LN); \85 ./scripts/translate.sh -d serverguide -l $(LN); \
80 fi86 fi
81 if find serverguide/$(LN) -name "*.xml"; then \87 if find serverguide/$(LN) -name "serverguide.xml"; then \
82 xsltproc --xinclude -o $(BASE)serverguide/$(LN)/serverguide.fo $(UBUNTUPDFXSL) serverguide/$(LN)/serverguide.xml; \88 xsltproc --xinclude -o $(BASE)serverguide/$(LN)/serverguide.fo $(UBUNTUPDFXSL) serverguide/$(LN)/serverguide.xml; \
83 fop -fo $(BASE)serverguide/$(LN)/serverguide.fo -pdf $(BASE)serverguide/$(LN)/serverguide.pdf; \89 fop -fo $(BASE)serverguide/$(LN)/serverguide.fo -pdf $(BASE)serverguide/$(LN)/serverguide.pdf; \
84 fi90 fi
91
92#
93# Some multi langauage build routines
94#
95
96serverguide-lang-trans:
97# Builds the translations for all non C languages.
98
99 $(foreach lingua, $(PO_FILES), ./scripts/translate.sh -d serverguide -l $(lingua);)
100
101serverguide-lang-html:
102# Builds the html serverguide for all non C languages.
103# Prerequisite: serverguide-lang-trans
104
105 $(foreach lingua, $(PO_FILES), \
106 if find serverguide/$(lingua) -name "serverguide.xml"; then \
107 mkdir -p $(BASE)serverguide/$(lingua); \
108 yelp-build html -o $(BASE)serverguide/$(lingua) -x $(UBUNTUXSL) serverguide/$(lingua)/serverguide.xml; \
109 lang=`echo $(lingua) | $(SED) -e 's/[@_]/-/'`; \
110 if test "$$lang" = "C"; then lang=en; fi; \
111 if test "$$lang" = "gl"; then lang=gl-GL; fi; \
112 if test "$$lang" = "ms"; then lang=ms-MS; fi; \
113 if test "$$lang" = "pl"; then lang=pl-PL; fi; \
114 $(SED) -i \
115 -e '1s/^/<!DOCTYPE html\>\n/' \
116 -e "s/<html>/<html lang="$$lang">/" \
117 $(BASE)serverguide/$(lingua)/*.html; \
118 fi;)
119
120serverguide-lang-pdf:
121# Builds the PDF serverguide for all non C languages.
122# Prerequisite: serverguide-lang-trans
123
124 $(foreach lingua, $(PO_FILES), \
125 if find serverguide/$(lingua) -name "serverguide.xml"; then \
126 xsltproc --xinclude -o $(BASE)serverguide/$(lingua)/serverguide.fo $(UBUNTUPDFXSL) serverguide/$(lingua)/serverguide.xml; \
127 fop -fo $(BASE)serverguide/$(lingua)/serverguide.fo -pdf $(BASE)serverguide/$(lingua)/serverguide.pdf; \
128 fi;)
129
130serverguide-lang-help:
131# Builds a single directory of all languages html and PDF files, ready for possible copy and inclusion in the help.ubuntu.com branch
132# Prerequisite: You must have already built the html and PDF's for all langauges, including the "C" ones.
133# Notes: Currently the .css files are actually identical for all languages, so why not use just one file.
134# Currently .png files are actually identical for all languages, so why not use just one set of files.
135# Currently .js files are actually identical for all languages, so why not use just one set of files.
136# Do not just copy the whole "C" directory or you will get the serverguuide.fo file, which you do not want.
137# Language codes are normalized to IETF format, as opposed to glibc format.
138# Does not create the ../../img directory, which is common across multiple releases. Local copy testing will need it.
139
140 rm -Rf $(BASE)help; \
141 mkdir -p $(BASE)help; \
142 $(foreach html_file, $(notdir $(wildcard $(BASE)serverguide/C/*.html)), \
143 cp $(BASE)serverguide/C/$(html_file) $(BASE)help/$(html_file).en; \
144 ) \
145 cp $(BASE)serverguide/C/*.css $(BASE)help; \
146 cp $(BASE)serverguide/C/*.png $(BASE)help; \
147 cp $(BASE)serverguide/C/serverguide.pdf $(BASE)help/serverguide.pdf.en; \
148
149 $(foreach lingua, $(PO_FILES), \
150 if find $(BASE)serverguide/$(lingua) -name "index.html"; then \
151 lang=`echo $(lingua) | $(SED) -e 's/[@_]/-/'`; \
152 if test "$$lang" = "gl"; then lang=gl-GL; fi; \
153 if test "$$lang" = "ms"; then lang=ms-MS; fi; \
154 if test "$$lang" = "pl"; then lang=pl-PL; fi; \
155 $(foreach html_file, $(notdir $(wildcard $(BASE)serverguide/$(lingua)/*.html)), \
156 cp $(BASE)serverguide/$(lingua)/$(html_file) $(BASE)help/$(html_file)."$$lang"; \
157 ) \
158 cp $(BASE)serverguide/$(lingua)/serverguide.pdf $(BASE)help/serverguide.pdf."$$lang"; \
159 $(SED) -i 's/href="$(lingua).css"/href="en.css"/' $(BASE)help/*.html."$$lang"; \
160 fi;)
161
162serverguide-lang-trans-clean:
163# 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.
164# Using both the presence check and the rm force option is redundant, but whatever.
165
166 $(foreach lingua, $(PO_FILES), \
167 if find serverguide/$(lingua) -name "serverguide.xml"; then \
168 rm -rf serverguide/$(lingua); \
169 fi;)

Subscribers

People subscribed via source and target branches