xref: /vim-8.2.3635/src/po/Makefile (revision cf2d8dee)
1# Makefile for the Vim message translations.
2
3# Include stuff found by configure.
4include ../auto/config.mk
5
6# TODO make this configurable
7# Note: ja.sjis, *.cp1250 and zh_CN.cp936 are only for MS-Windows, they are
8# not installed on Unix
9
10LANGUAGES = \
11		af \
12		ca \
13		cs \
14		de \
15		en_GB \
16		eo \
17		es \
18		fi \
19		fr \
20		ga \
21		it \
22		ja \
23		ko \
24		ko.UTF-8 \
25		nb \
26		nl \
27		no \
28		pl \
29		pt_BR \
30		ru \
31		sk \
32		sv \
33		uk \
34		vi \
35		zh_CN \
36		zh_CN.UTF-8 \
37		zh_TW \
38		zh_TW.UTF-8
39
40CONVERTED = \
41		cs.cp1250 \
42		ja.sjis \
43		ja.euc-jp \
44		pl.cp1250 \
45		pl.UTF-8 \
46		ru.cp1251 \
47		sk.cp1250 \
48		uk.cp1251 \
49		zh_CN.cp936
50
51MOFILES = \
52		af.mo \
53		ca.mo \
54		cs.mo \
55		de.mo \
56		en_GB.mo \
57		eo.mo \
58		es.mo \
59		fi.mo \
60		fr.mo \
61		ga.mo \
62		it.mo \
63		ja.mo \
64		ko.mo \
65		ko.UTF-8.mo \
66		nb.mo \
67		nl.mo \
68		no.mo \
69		pl.mo \
70		pt_BR.mo \
71		ru.mo \
72		sk.mo \
73		sv.mo \
74		uk.mo \
75		vi.mo \
76		zh_CN.UTF-8.mo \
77		zh_CN.mo \
78		zh_TW.UTF-8.mo \
79		zh_TW.mo
80
81MOCONVERTED = \
82		cs.cp1250.mo \
83		ja.sjis.mo \
84		ja.euc-jp.mo \
85		pl.cp1250.mo \
86		pl.UTF-8.mo \
87		ru.cp1251.mo \
88		sk.cp1250.mo \
89		uk.cp1251.mo \
90		zh_CN.cp936.mo
91
92CHECKFILES = \
93		af.ck \
94		ca.ck \
95		cs.ck \
96		de.ck \
97		en_GB.ck \
98		eo.ck \
99		es.ck \
100		fi.ck \
101		fr.ck \
102		ga.ck \
103		it.ck \
104		ja.ck \
105		ko.ck \
106		ko.UTF-8.ck \
107		nb.ck \
108		nl.ck \
109		no.ck \
110		pl.ck \
111		pt_BR.ck \
112		ru.ck \
113		sk.ck \
114		sv.ck \
115		uk.ck \
116		vi.ck \
117		zh_CN.UTF-8.ck \
118		zh_CN.ck \
119		zh_TW.UTF-8.ck \
120		zh_TW.ck \
121		cs.cp1250.ck \
122		ja.sjis.ck \
123		ja.euc-jp.ck \
124		pl.cp1250.ck \
125		pl.UTF-8.ck \
126		ru.cp1251.ck \
127		sk.cp1250.ck \
128		uk.cp1251.ck \
129		zh_CN.cp936.ck
130
131PACKAGE = vim
132SHELL = /bin/sh
133VIM = ../vim
134
135# The OLD_PO_FILE_INPUT and OLD_PO_FILE_OUTPUT are for the new GNU gettext
136# tools 0.10.37, which use a slightly different .po file format that is not
137# compatible with Solaris (and old gettext implementations) unless these are
138# set.  gettext 0.10.36 will not work!
139MSGFMTCMD = OLD_PO_FILE_INPUT=yes $(MSGFMT) -v
140XGETTEXT = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes xgettext
141MSGMERGE = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes msgmerge
142
143.SUFFIXES:
144.SUFFIXES: .po .mo .pot .ck
145.PHONY: all install uninstall prefixcheck converted check clean checkclean distclean update-po $(LANGUAGES) $(CONVERTED)
146
147.po.mo:
148	$(MSGFMTCMD) -o $@ $<
149
150.po.ck:
151	$(VIM) -u NONE -e -X -S check.vim -c "if error == 0 | q | endif" -c cq $<
152	touch $@
153
154all: $(MOFILES) $(MOCONVERTED)
155
156check: $(CHECKFILES)
157
158install: $(MOFILES) $(MOCONVERTED)
159	@$(MAKE) prefixcheck
160	for lang in $(LANGUAGES) $(CONVERTED); do \
161	  dir=$(LOCALEDIR)/$$lang/; \
162	  if test ! -x "$$dir"; then \
163	    mkdir $$dir; chmod 755 $$dir; \
164	  fi; \
165	  dir=$(LOCALEDIR)/$$lang/LC_MESSAGES; \
166	  if test ! -x "$$dir"; then \
167	    mkdir $$dir; chmod 755 $$dir; \
168	  fi; \
169	  if test -r $$lang.mo; then \
170	    $(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \
171	    chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \
172	  fi; \
173	done
174
175uninstall:
176	@$(MAKE) prefixcheck
177	for cat in $(MOFILES) $(MOCONVERTED); do \
178	  cat=`basename $$cat`; \
179	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
180	  rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
181	done
182
183converted: $(MOCONVERTED)
184
185# nl.po was added later, if it does not exist use a file with just a # in it
186# (an empty file doesn't work with old msgfmt).
187nl.po:
188	@( echo \# > nl.po )
189
190# Norwegian/Bokmal: "nb" is an alias for "no".
191# Copying the file is not efficient, but I don't know of another way to make
192# this work.
193nb.po: no.po
194	cp no.po nb.po
195
196# Convert ja.po to create ja.sjis.po.  Requires doubling backslashes in the
197# second byte.  Don't depend on sjiscorr, it should only be compiled when
198# ja.sjis.po is outdated.
199ja.sjis.po: ja.po
200	@$(MAKE) sjiscorr
201	rm -f ja.sjis.po
202	iconv -f utf-8 -t cp932 ja.po | ./sjiscorr > ja.sjis.po
203
204sjiscorr: sjiscorr.c
205	$(CC) -o sjiscorr sjiscorr.c
206
207ja.euc-jp.po: ja.po
208	iconv -f utf-8 -t euc-jp ja.po | \
209		sed -e 's/charset=utf-8/charset=euc-jp/' -e 's/# Original translations/# Generated from ja.po, DO NOT EDIT/' > ja.euc-jp.po
210
211# Convert cs.po to create cs.cp1250.po.
212cs.cp1250.po: cs.po
213	rm -f cs.cp1250.po
214	iconv -f iso-8859-2 -t cp1250 cs.po | \
215		sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' > cs.cp1250.po
216
217# Convert pl.po to create pl.cp1250.po.
218pl.cp1250.po: pl.po
219	rm -f pl.cp1250.po
220	iconv -f iso-8859-2 -t cp1250 pl.po | \
221		sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.cp1250.po
222
223# Convert pl.po to create pl.UTF-8.po.
224pl.UTF-8.po: pl.po
225	rm -f pl.UTF-8.po
226	iconv -f iso-8859-2 -t utf-8 pl.po | \
227		sed -e 's/charset=ISO-8859-2/charset=utf-8/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.UTF-8.po
228
229# Convert sk.po to create sk.cp1250.po.
230sk.cp1250.po: sk.po
231	rm -f sk.cp1250.po
232	iconv -f iso-8859-2 -t cp1250 sk.po | \
233		sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' > sk.cp1250.po
234
235# Convert zh_CN.po to create zh_CN.cp936.po.
236# set 'charset' to gbk to avoid that msfmt generates a warning
237zh_CN.cp936.po: zh_CN.po
238	rm -f zh_CN.cp936.po
239	iconv -f gb2312 -t cp936 zh_CN.po | \
240		sed -e 's/charset=gb2312/charset=gbk/' -e 's/# Original translations/# Generated from zh_CN.po, DO NOT EDIT/' > zh_CN.cp936.po
241
242# Convert ko.UTF-8.po to create ko.po.
243ko.po: ko.UTF-8.po
244	rm -f ko.po
245	iconv -f UTF-8 -t euc-kr ko.UTF-8.po | \
246		sed -e 's/charset=UTF-8/charset=euc-kr/' \
247		    -e 's/# Korean translation for Vim/# Generated from ko.UTF-8.po, DO NOT EDIT/' \
248		    > ko.po
249
250# Convert ru.po to create ru.cp1251.po.
251ru.cp1251.po: ru.po
252	rm -f ru.cp1251.po
253	iconv -f utf-8 -t cp1251 ru.po | \
254		sed -e 's/charset=utf-8/charset=cp1251/' -e 's/# Original translations/# Generated from ru.po, DO NOT EDIT/' > ru.cp1251.po
255
256# Convert uk.po to create uk.cp1251.po.
257uk.cp1251.po: uk.po
258	rm -f uk.cp1251.po
259	iconv -f utf-8 -t cp1251 uk.po | \
260		sed -e 's/charset=utf-8/charset=cp1251/' -e 's/# Original translations/# Generated from uk.po, DO NOT EDIT/' > uk.cp1251.po
261
262prefixcheck:
263	@if test "x" = "x$(prefix)"; then \
264	  echo "******************************************"; \
265	  echo "  please use make from the src directory  "; \
266	  echo "******************************************"; \
267	  exit 1; \
268	fi
269
270clean: checkclean
271	rm -f core core.* *.old.po *.mo *.pot sjiscorr
272
273distclean: clean
274
275checkclean:
276	rm -f *.ck
277
278$(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h ../if_py_both.h
279	cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \
280		--add-comments --keyword=_ --keyword=N_ \
281		*.c if_perl.xs GvimExt/gvimext.cpp globals.h if_py_both.h
282	mv -f ../$(PACKAGE).po $(PACKAGE).pot
283
284update-po: $(LANGUAGES)
285
286# Don't add a dependency here, we only want to update the .po files manually
287$(LANGUAGES):
288	@$(MAKE) $(PACKAGE).pot
289	if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi
290	mv $@.po $@.po.old
291	if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \
292	    rm -f $@.po.old; \
293	else \
294	    echo "msgmerge for [email protected] failed!"; mv $@.po.old $@.po; \
295	fi
296