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