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