xref: /vim-8.2.3635/src/po/Makefile (revision 8d616172)
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# nl.po was added later, if it does not exist use an empty file.
180nl.po:
181	touch nl.po
182
183# Norwegian/Bokmal: "nb" is an alias for "no".
184# Copying the file is not efficient, but I don't know of another way to make
185# this work.
186nb.po: no.po
187	cp no.po nb.po
188
189# Convert ja.po to create ja.sjis.po.  Requires doubling backslashes in the
190# second byte.  Don't depend on sjiscorr, it should only be compiled when
191# ja.sjis.po is outdated.
192ja.sjis.po: ja.po
193	@$(MAKE) sjiscorr
194	rm -f ja.sjis.po
195	iconv -f euc-jp -t cp932 ja.po | ./sjiscorr > ja.sjis.po
196
197sjiscorr: sjiscorr.c
198	$(CC) -o sjiscorr sjiscorr.c
199
200# Convert cs.po to create cs.cp1250.po.
201cs.cp1250.po: cs.po
202	rm -f cs.cp1250.po
203	iconv -f iso-8859-2 -t cp1250 cs.po | \
204		sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' > cs.cp1250.po
205
206# Convert pl.po to create pl.cp1250.po.
207pl.cp1250.po: pl.po
208	rm -f pl.cp1250.po
209	iconv -f iso-8859-2 -t cp1250 pl.po | \
210		sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.cp1250.po
211
212# Convert pl.po to create pl.UTF-8.po.
213pl.UTF-8.po: pl.po
214	rm -f pl.UTF-8.po
215	iconv -f iso-8859-2 -t utf-8 pl.po | \
216		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
217
218# Convert sk.po to create sk.cp1250.po.
219sk.cp1250.po: sk.po
220	rm -f sk.cp1250.po
221	iconv -f iso-8859-2 -t cp1250 sk.po | \
222		sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' > sk.cp1250.po
223
224# Convert zh_CN.po to create zh_CN.cp936.po.
225# set 'charset' to gbk to avoid that msfmt generates a warning
226zh_CN.cp936.po: zh_CN.po
227	rm -f zh_CN.cp936.po
228	iconv -f gb2312 -t cp936 zh_CN.po | \
229		sed -e 's/charset=gb2312/charset=gbk/' -e 's/# Original translations/# Generated from zh_CN.po, DO NOT EDIT/' > zh_CN.cp936.po
230
231# Convert ko.UTF-8.po to create ko.po.
232ko.po: ko.UTF-8.po
233	rm -f ko.po
234	iconv -f UTF-8 -t euc-kr ko.UTF-8.po | \
235		sed -e 's/charset=UTF-8/charset=euc-kr/' \
236		    -e 's/# Korean translation for Vim/# Generated from ko.UTF-8.po, DO NOT EDIT/' \
237		    > ko.po
238
239# Convert ru.po to create ru.cp1251.po.
240ru.cp1251.po: ru.po
241	rm -f ru.cp1251.po
242	iconv -f utf-8 -t cp1251 ru.po | \
243		sed -e 's/charset=utf-8/charset=cp1251/' -e 's/# Original translations/# Generated from ru.po, DO NOT EDIT/' > ru.cp1251.po
244
245# Convert uk.po to create uk.cp1251.po.
246uk.cp1251.po: uk.po
247	rm -f uk.cp1251.po
248	iconv -f utf-8 -t cp1251 uk.po | \
249		sed -e 's/charset=utf-8/charset=cp1251/' -e 's/# Original translations/# Generated from uk.po, DO NOT EDIT/' > uk.cp1251.po
250
251prefixcheck:
252	@if test "x" = "x$(prefix)"; then \
253	  echo "******************************************"; \
254	  echo "  please use make from the src directory  "; \
255	  echo "******************************************"; \
256	  exit 1; \
257	fi
258
259clean: checkclean
260	rm -f core core.* *.old.po *.mo *.pot sjiscorr
261
262distclean: clean
263
264checkclean:
265	rm -f *.ck
266
267$(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h ../if_py_both.h
268	cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \
269		--add-comments --keyword=_ --keyword=N_ \
270		*.c if_perl.xs GvimExt/gvimext.cpp globals.h if_py_both.h
271	mv -f ../$(PACKAGE).po $(PACKAGE).pot
272
273update-po: $(LANGUAGES)
274
275# Don't add a dependency here, we only want to update the .po files manually
276$(LANGUAGES):
277	@$(MAKE) $(PACKAGE).pot
278	if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi
279	mv $@.po $@.po.old
280	if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \
281	    rm -f $@.po.old; \
282	else \
283	    echo "msgmerge for [email protected] failed!"; mv $@.po.old $@.po; \
284	fi
285