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