blob: 9e8c655217f520a038b1a81321830785d6dd792a [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001# 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
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +00007LANGUAGES = \
8 af \
9 ca \
10 cs \
11 de \
12 en_GB \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000013 eo \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000014 es \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000015 fi \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000016 fr \
17 ga \
18 it \
19 ja \
20 ko \
Bram Moolenaar28c37952010-01-06 20:29:28 +010021 nb \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000022 no \
23 pl \
Bram Moolenaare37d50a2008-08-06 17:06:04 +000024 pt_BR \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000025 ru \
26 sk \
27 sv \
28 uk \
29 vi \
30 zh_CN \
31 zh_CN.UTF-8 \
32 zh_TW \
Bram Moolenaar78622822005-08-23 21:00:13 +000033 zh_TW.UTF-8
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000034
35MOFILES = \
36 af.mo \
37 ca.mo \
38 cs.mo \
39 de.mo \
40 en_GB.mo \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000041 eo.mo \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000042 es.mo \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000043 fi.mo \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000044 fr.mo \
45 ga.mo \
46 it.mo \
47 ja.mo \
48 ko.mo \
Bram Moolenaar28c37952010-01-06 20:29:28 +010049 nb.mo \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000050 no.mo \
51 pl.mo \
Bram Moolenaare37d50a2008-08-06 17:06:04 +000052 pt_BR.mo \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000053 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 \
Bram Moolenaar78622822005-08-23 21:00:13 +000061 zh_TW.mo
Bram Moolenaar071d4272004-06-13 20:20:40 +000062
Bram Moolenaar58d98232005-07-23 22:25:46 +000063CONVERTED = \
64 cs.cp1250.mo \
65 ja.sjis.mo \
66 pl.cp1250.mo \
Bram Moolenaar910f66f2006-04-05 20:41:53 +000067 pl.UTF-8.mo \
Bram Moolenaar58d98232005-07-23 22:25:46 +000068 ru.cp1251.mo \
69 sk.cp1250.mo \
70 uk.cp1251.mo \
Bram Moolenaar78622822005-08-23 21:00:13 +000071 zh_CN.cp936.mo
Bram Moolenaar58d98232005-07-23 22:25:46 +000072
73CHECKFILES = \
74 af.ck \
75 ca.ck \
76 cs.ck \
77 de.ck \
78 en_GB.ck \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000079 eo.ck \
Bram Moolenaar58d98232005-07-23 22:25:46 +000080 es.ck \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000081 fi.ck \
Bram Moolenaar58d98232005-07-23 22:25:46 +000082 fr.ck \
83 ga.ck \
84 it.ck \
85 ja.ck \
86 ko.ck \
Bram Moolenaar28c37952010-01-06 20:29:28 +010087 nb.ck \
Bram Moolenaar58d98232005-07-23 22:25:46 +000088 no.ck \
89 pl.ck \
Bram Moolenaare37d50a2008-08-06 17:06:04 +000090 pt_BR.ck \
Bram Moolenaar58d98232005-07-23 22:25:46 +000091 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 \
Bram Moolenaar910f66f2006-04-05 20:41:53 +0000103 pl.UTF-8.ck \
Bram Moolenaar58d98232005-07-23 22:25:46 +0000104 ru.cp1251.ck \
105 sk.cp1250.ck \
106 uk.cp1251.ck \
Bram Moolenaar78622822005-08-23 21:00:13 +0000107 zh_CN.cp936.ck
Bram Moolenaar58d98232005-07-23 22:25:46 +0000108
Bram Moolenaar071d4272004-06-13 20:20:40 +0000109PACKAGE = vim
110SHELL = /bin/sh
Bram Moolenaar58d98232005-07-23 22:25:46 +0000111VIM = ../vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000112
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:
Bram Moolenaar58d98232005-07-23 22:25:46 +0000122.SUFFIXES: .po .mo .pot .ck
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000123.PHONY: all install uninstall prefixcheck converted check clean checkclean distclean update-po $(LANGUAGES)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000124
125.po.mo:
126 $(MSGFMT) -o $@ $<
127
Bram Moolenaar58d98232005-07-23 22:25:46 +0000128.po.ck:
Bram Moolenaar28c37952010-01-06 20:29:28 +0100129 $(VIM) -u NONE -e -X -S check.vim -c "if error == 0 | q | endif" -c cq $<
Bram Moolenaar58d98232005-07-23 22:25:46 +0000130 touch $@
131
Bram Moolenaar071d4272004-06-13 20:20:40 +0000132all: $(MOFILES)
133
Bram Moolenaar58d98232005-07-23 22:25:46 +0000134check: $(CHECKFILES)
135
Bram Moolenaar071d4272004-06-13 20:20:40 +0000136install: $(MOFILES)
Bram Moolenaar58d98232005-07-23 22:25:46 +0000137 @$(MAKE) prefixcheck
Bram Moolenaar071d4272004-06-13 20:20:40 +0000138 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:
Bram Moolenaar58d98232005-07-23 22:25:46 +0000154 @$(MAKE) prefixcheck
Bram Moolenaar071d4272004-06-13 20:20:40 +0000155 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
Bram Moolenaar58d98232005-07-23 22:25:46 +0000161converted: $(CONVERTED)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000162
Bram Moolenaar28c37952010-01-06 20:29:28 +0100163# 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000169# 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
Bram Moolenaar910f66f2006-04-05 20:41:53 +0000192# 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000198# 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
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000214 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000216
Bram Moolenaar15d0a8c2004-09-06 17:44:46 +0000217# Convert uk.po to create uk.cp1251.po.
218uk.cp1251.po: uk.po
219 rm -f uk.cp1251.po
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000220 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
Bram Moolenaar15d0a8c2004-09-06 17:44:46 +0000222
Bram Moolenaar58d98232005-07-23 22:25:46 +0000223prefixcheck:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000224 @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
Bram Moolenaar316059c2006-01-14 21:18:42 +0000231clean: checkclean
232 rm -f core core.* *.old.po *.mo *.pot sjiscorr
Bram Moolenaar071d4272004-06-13 20:20:40 +0000233
234distclean: clean
235
Bram Moolenaar316059c2006-01-14 21:18:42 +0000236checkclean:
237 rm -f *.ck
238
Bram Moolenaar071d4272004-06-13 20:20:40 +0000239#
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
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000249update-po: $(LANGUAGES)
250
Bram Moolenaar071d4272004-06-13 20:20:40 +0000251# 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 $@.po failed!"; mv $@.po.old $@.po; \
260 fi