Debian Codegraph @

src/po/Makefile

raw symbols SCIP
1 # Makefile for the Vim message translations.
2
3 # Include stuff found by configure.
4 include ../auto/config.mk
5
6 # Get LANGUAGES, MOFILES, MOCONVERTED and others.
7 include Make_all.mak
8
9 # Note: ja.sjis, *.cp1250 and zh_CN.cp936 are only for MS-Windows, they are
10 # not installed on Unix.
11
12 PACKAGE = vim
13 SHELL = /bin/sh
14 VIMPROG = ../vim
15
16 # MacOS sed is locale aware, set $LANG to avoid problems.
17 SED = LANG=C sed
18
19 # The OLD_PO_FILE_INPUT and OLD_PO_FILE_OUTPUT are for the new GNU gettext
20 # tools 0.10.37, which use a slightly different .po file format that is not
21 # compatible with Solaris (and old gettext implementations) unless these are
22 # set. gettext 0.10.36 will not work!
23
24 # MSGFMTCMD is defined by Configure in ../auto/config.mk
25 XGETTEXT = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes xgettext
26 MSGMERGE = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes msgmerge
27
28 .SUFFIXES:
29 .SUFFIXES: .po .mo .pot .ck
30 .PHONY: all install uninstall prefixcheck originals converted check clean \
31 checkclean distclean update-po $(LANGUAGES)
32
33 all: $(MOFILES) $(MOCONVERTED) $(MSGFMT_DESKTOP)
34
35 originals: $(MOFILES)
36
37 converted: $(MOCONVERTED)
38
39 .po.mo:
40 $(MSGFMTCMD) -o $@ $<
41
42 .po.ck:
43 $(VIMPROG) -u NONE --noplugins -e -s -X --cmd "set enc=utf-8" \
44 -S check.vim -c "if error == 0 | q | else | num 2 | cq | endif" \
45 $<
46 touch $@
47
48 check: $(CHECKFILES)
49
50 # Installing for real.
51 install: $(MOFILES) $(MOCONVERTED)
52 @$(MAKE) prefixcheck
53 for lang in $(LANGUAGES); do \
54 dir=$(LOCALEDIR)/$$lang/; \
55 if test ! -x "$$dir"; then \
56 mkdir $$dir; chmod 755 $$dir; \
57 fi; \
58 dir=$(LOCALEDIR)/$$lang/LC_MESSAGES; \
59 if test ! -x "$$dir"; then \
60 mkdir $$dir; chmod 755 $$dir; \
61 fi; \
62 if test -r $$lang.mo; then \
63 $(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \
64 chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \
65 fi; \
66 done
67
68 uninstall:
69 @$(MAKE) prefixcheck
70 for cat in $(MOFILES) $(MOCONVERTED); do \
71 cat=`basename $$cat`; \
72 lang=`echo $$cat | $(SED) 's/\$(CATOBJEXT)$$//'`; \
73 rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
74 done
75
76 # Installing for local tryout into ../../runtime/lang.
77 tryoutinstall: $(MOFILES) $(MOCONVERTED)
78 @$(MAKE) prefixcheck
79 for lang in $(LANGUAGES); do \
80 dir=../../runtime/lang/$$lang/; \
81 if test ! -x "$$dir"; then \
82 mkdir $$dir; chmod 755 $$dir; \
83 fi; \
84 dir=../../runtime/lang/$$lang/LC_MESSAGES; \
85 if test ! -x "$$dir"; then \
86 mkdir $$dir; chmod 755 $$dir; \
87 fi; \
88 if test -r $$lang.mo; then \
89 cp $$lang.mo $$dir/$(PACKAGE).mo; \
90 chmod 644 $$dir/$(PACKAGE).mo; \
91 fi; \
92 done
93
94 # Norwegian/Bokmal: "nb" is an alias for "no".
95 # Copying the file is not efficient, but I don't know of another way to make
96 # this work.
97 nb.po: no.po
98 cp no.po nb.po
99
100 # Convert ja.po to create ja.sjis.po. Requires doubling backslashes in the
101 # second byte. Don't depend on sjiscorr, it should only be compiled when
102 # ja.sjis.po is outdated.
103 ja.sjis.po: ja.po
104 @$(MAKE) sjiscorr
105 rm -f $@
106 iconv -f UTF-8 -t CP932 $? | ./sjiscorr > $@
107
108 sjiscorr: sjiscorr.c
109 $(CC) -o sjiscorr sjiscorr.c
110
111 ja.euc-jp.po: ja.po
112 iconv -f UTF-8 -t EUC-JP $? | \
113 $(SED) -e 's/charset=[uU][tT][fF]-8/charset=EUC-JP/' \
114 -e 's/# Original translations/# Generated from $?, DO NOT EDIT/' \
115 > $@
116
117 # Convert cs.po to create cs.cp1250.po.
118 cs.cp1250.po: cs.po
119 rm -f $@
120 iconv -f ISO-8859-2 -t CP1250 $? | \
121 $(SED) -e 's/charset=[iI][sS][oO]-8859-2/charset=CP1250/' \
122 -e 's/# Original translations/# Generated from $?, DO NOT EDIT/' \
123 > $@
124
125 # Convert pl.po to create pl.cp1250.po.
126 pl.cp1250.po: pl.po
127 rm -f $@
128 iconv -f ISO-8859-2 -t CP1250 $? | \
129 $(SED) -e 's/charset=[iI][sS][oO]-8859-2/charset=CP1250/' \
130 -e 's/# Original translations/# Generated from $?, DO NOT EDIT/' \
131 > $@
132
133 # Convert pl.po to create pl.UTF-8.po.
134 pl.UTF-8.po: pl.po
135 rm -f $@
136 iconv -f ISO-8859-2 -t UTF-8 $? | \
137 $(SED) -e 's/charset=[iI][sS][oO]-8859-2/charset=UTF-8/' \
138 -e 's/# Original translations/# Generated from $?, DO NOT EDIT/' \
139 > $@
140
141 # Convert sk.po to create sk.cp1250.po.
142 sk.cp1250.po: sk.po
143 rm -f $@
144 iconv -f ISO-8859-2 -t CP1250 $? | \
145 $(SED) -e 's/charset=[iI][sS][oO]-8859-2/charset=CP1250/' \
146 -e 's/# Original translations/# Generated from $?, DO NOT EDIT/' \
147 > $@
148
149 # Convert zh_CN.UTF-8.po to create zh_CN.po.
150 zh_CN.po: zh_CN.UTF-8.po
151 rm -f $@
152 iconv -f UTF-8 -t GB2312 $? | \
153 $(SED) -e 's/charset=[uU][tT][fF]-8/charset=GB2312/' \
154 -e 's/# Original translations/# Generated from $?, DO NOT EDIT/' \
155 > $@
156
157 # Convert zh_CN.UTF-8.po to create zh_CN.cp936.po.
158 # Set 'charset' to gbk to avoid that msfmt generates a warning.
159 # This used to convert from zh_CN.po, but that results in a conversion error.
160 zh_CN.cp936.po: zh_CN.UTF-8.po
161 rm -f $@
162 iconv -f UTF-8 -t CP936 $? | \
163 $(SED) -e 's/charset=[uU][tT][fF]-8/charset=GBK/' \
164 -e 's/# Original translations/# Generated from $?, DO NOT EDIT/' \
165 > $@
166
167 # Convert zh_TW.UTF-8.po to create zh_TW.po.
168 zh_TW.po: zh_TW.UTF-8.po
169 rm -f $@
170 iconv -f UTF-8 -t BIG5 $? | \
171 $(SED) -e 's/charset=[uU][tT][fF]-8/charset=BIG5/' \
172 -e 's/# Original translations/# Generated from $?, DO NOT EDIT/' \
173 > $@
174
175
176 # Convert zh_TW.UTF-8.po to create zh_TW.po with backslash characters.
177 # Requires doubling backslashes in the second byte. Don't depend on big5corr,
178 # it should only be compiled when zh_TW.po is outdated.
179
180 #
181 # 06.11.23, added by Restorer
182 # For more details, see:
183 # https://github.com/vim/vim/pull/3261
184 # https://github.com/vim/vim/pull/3476
185 # https://github.com/vim/vim/pull/12153
186 # (read all comments)
187 #
188 # I checked the workability on the list of backslash characters
189 # specified in zh_TW.UTF-8.po. It works.
190 # But it is better to have someone native speaker check it.
191 #
192
193 #zh_TW.po: zh_TW.UTF-8.po
194 # @$(MAKE) big5corr
195 # rm -f $@
196 # iconv -f UTF-8 -t BIG5 $? | ./big5corr > $@
197
198
199 # 06.11.23, added by Restorer
200 # See above in the zh_tw.po conversion section for backslashes.
201 #big5corr: big5corr.c
202 # $(CC) -o big5corr big5corr.c
203
204
205 # Convert ko.UTF-8.po to create ko.po.
206 ko.po: ko.UTF-8.po
207 rm -f $@
208 iconv -f UTF-8 -t EUC-KR $? | \
209 $(SED) -e 's/charset=[uU][tT][fF]-8/charset=EUC-KR/' \
210 -e 's/# Original translations/# Generated from $?, DO NOT EDIT/' \
211 > $@
212
213 # Convert ru.po to create ru.cp1251.po.
214 ru.cp1251.po: ru.po
215 rm -f $@
216 iconv -f UTF-8 -t CP1251 $? | \
217 $(SED) -e 's/charset=[uU][tT][fF]-8/charset=CP1251/' \
218 -e 's/# Original translations/# Generated from $?, DO NOT EDIT/' \
219 > $@
220
221 # Convert uk.po to create uk.cp1251.po.
222 uk.cp1251.po: uk.po
223 rm -f $@
224 iconv -f UTF-8 -t CP1251 $? | \
225 $(SED) -e 's/charset=[uU][tT][fF]-8/charset=CP1251/' \
226 -e 's/# Original translations/# Generated from $?, DO NOT EDIT/' \
227 > $@
228
229 prefixcheck:
230 @if test "x" = "x$(prefix)"; then \
231 echo "******************************************"; \
232 echo " Please use make from the src directory "; \
233 echo "******************************************"; \
234 exit 1; \
235 fi
236
237 clean: checkclean
238 - rm -f core core.* *.old.po *.mo sjiscorr
239 - rm -f LINGUAS vim.desktop gvim.desktop tmp_*desktop
240 - rm -f ./allfiles
241 # - rm -f big5corr
242
243 distclean: clean
244
245 checkclean:
246 rm -f *.ck
247
248 PO_INPUTLIST = \
249 ../*.c \
250 ../if_perl.xs \
251 ../GvimExt/gvimext.cpp \
252 ../errors.h \
253 ../globals.h \
254 ../if_py_both.h \
255 ../vim.h \
256 gvim.desktop.in \
257 vim.desktop.in
258
259 $(PACKAGE).pot: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST)
260 # Convert the Vim scripts to (what looks like) Javascript.
261 $(VIMPROG) -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot \
262 $(PO_VIM_INPUTLIST)
263 @ echo ${PO_INPUTLIST} | tr ' ' '\n' > ./allfiles
264 @ cat ./vim_to_js >> ./allfiles
265 # Create vim.pot.
266 $(XGETTEXT) --default-domain=$(PACKAGE) --output=$(PACKAGE).pot \
267 --add-comments $(XGETTEXT_KEYWORDS) --files-from=./allfiles \
268 --no-location --copyright-holder="$$(date +%Y), The Vim Project" \
269 --package-name=Vim --msgid-bugs-address="[email protected]"
270 # Fix Vim scripts names, so that "gf" works.
271 $(VIMPROG) -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot \
272 $(PO_VIM_INPUTLIST)
273 # Delete the temporary files.
274 rm -f *.js ./vim_to_js allfiles
275
276 vim.desktop: vim.desktop.in $(POFILES)
277 echo $(LANGUAGES) | tr " " "\n" |$(SED) -e '/[.]/d' | sort > LINGUAS
278 $(MSGFMT) --desktop -d . --template vim.desktop.in -o tmp_vim.desktop
279 rm -f LINGUAS
280 if command -v desktop-file-validate; \
281 then desktop-file-validate tmp_vim.desktop; fi
282 mv tmp_vim.desktop vim.desktop
283 cp vim.desktop ../../runtime/
284
285 # The dependency on vim.desktop is only to avoid the two targets are build at
286 # the same time, which causes a race for the LINGUAS file.
287 gvim.desktop: gvim.desktop.in $(POFILES) vim.desktop
288 echo $(LANGUAGES) | tr " " "\n" |$(SED) -e '/[.]/d' | sort > LINGUAS
289 $(MSGFMT) --desktop -d . --template gvim.desktop.in -o tmp_gvim.desktop
290 rm -f LINGUAS
291 if command -v desktop-file-validate; \
292 then desktop-file-validate tmp_gvim.desktop; fi
293 mv tmp_gvim.desktop gvim.desktop
294 cp gvim.desktop ../../runtime/
295
296 # Only original translations with default encoding should be updated.
297 # The files that are converted to a different encoding clearly state "DO NOT EDIT".
298 update-po: $(MOFILES:.mo=)
299
300 # Don't add a dependency here, we only want to update the .po files manually.
301 $(LANGUAGES):
302 @$(MAKE) $(PACKAGE).pot
303 if test ! -f [email protected]; then cp [email protected] [email protected]; fi
304 mv [email protected] [email protected]
305 if $(MSGMERGE) [email protected] $(PACKAGE).pot -o [email protected]; then \
306 rm -f [email protected]; \
307 else \
308 echo "msgmerge for [email protected] failed!"; mv [email protected] [email protected]; \
309 fi
310
311
312 #######
313 # For translations of plug-ins
314 #######
315
316 # Preparing the POT file of the plug-in package
317 POT_PLUGPACKAGE_PATH = $(PWD)
318 $(PLUGPACKAGE).pot: $(PO_PLUG_INPUTLIST)
319 $(VIMPROG) -u NONE --not-a-term -S tojavascript.vim \
320 $(PLUGPACKAGE).pot $?
321 $(XGETTEXT) --from-code=UTF-8 --default-domain=$(PLUGPACKAGE) \
322 --package-name=$(PLUGPACKAGE) \
323 --output-dir=$(POT_PLUGPACKAGE_PATH) \
324 --output=$(PLUGPACKAGE).pot --files-from=./vim_to_js
325 $(VIMPROG) -u NONE --not-a-term -S fixfilenames.vim \
326 $(POT_PLUGPACKAGE_PATH)/$(PLUGPACKAGE).pot $?
327 rm -f *.js ./vim_to_js
328
329 # Converting the PO file of the plug-in package to the binary format of the MO
330 MO_PLUGPACKAGE_PATH = $(PWD)
331 $(PLUGPACKAGE).mo: $(PO_PLUGPACKAGE)
332 $(MSGFMTCMD) -o $(MO_PLUGPACKAGE_PATH)/$@ $?
333
334 # vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0 ft=make: