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