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