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