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