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