blob: e6290caaa7c577e54ca4ffba62e586e4a6dc53ae [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 \
21 no \
22 pl \
Bram Moolenaare37d50a2008-08-06 17:06:04 +000023 pt_BR \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000024 ru \
25 sk \
26 sv \
27 uk \
28 vi \
29 zh_CN \
30 zh_CN.UTF-8 \
31 zh_TW \
Bram Moolenaar78622822005-08-23 21:00:13 +000032 zh_TW.UTF-8
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000033
34MOFILES = \
35 af.mo \
36 ca.mo \
37 cs.mo \
38 de.mo \
39 en_GB.mo \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000040 eo.mo \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000041 es.mo \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000042 fi.mo \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000043 fr.mo \
44 ga.mo \
45 it.mo \
46 ja.mo \
47 ko.mo \
48 no.mo \
49 pl.mo \
Bram Moolenaare37d50a2008-08-06 17:06:04 +000050 pt_BR.mo \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000051 ru.mo \
52 sk.mo \
53 sv.mo \
54 uk.mo \
55 vi.mo \
56 zh_CN.UTF-8.mo \
57 zh_CN.mo \
58 zh_TW.UTF-8.mo \
Bram Moolenaar78622822005-08-23 21:00:13 +000059 zh_TW.mo
Bram Moolenaar071d4272004-06-13 20:20:40 +000060
Bram Moolenaar58d98232005-07-23 22:25:46 +000061CONVERTED = \
62 cs.cp1250.mo \
63 ja.sjis.mo \
64 pl.cp1250.mo \
Bram Moolenaar910f66f2006-04-05 20:41:53 +000065 pl.UTF-8.mo \
Bram Moolenaar58d98232005-07-23 22:25:46 +000066 ru.cp1251.mo \
67 sk.cp1250.mo \
68 uk.cp1251.mo \
Bram Moolenaar78622822005-08-23 21:00:13 +000069 zh_CN.cp936.mo
Bram Moolenaar58d98232005-07-23 22:25:46 +000070
71CHECKFILES = \
72 af.ck \
73 ca.ck \
74 cs.ck \
75 de.ck \
76 en_GB.ck \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000077 eo.ck \
Bram Moolenaar58d98232005-07-23 22:25:46 +000078 es.ck \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000079 fi.ck \
Bram Moolenaar58d98232005-07-23 22:25:46 +000080 fr.ck \
81 ga.ck \
82 it.ck \
83 ja.ck \
84 ko.ck \
85 no.ck \
86 pl.ck \
Bram Moolenaare37d50a2008-08-06 17:06:04 +000087 pt_BR.ck \
Bram Moolenaar58d98232005-07-23 22:25:46 +000088 ru.ck \
89 sk.ck \
90 sv.ck \
91 uk.ck \
92 vi.ck \
93 zh_CN.UTF-8.ck \
94 zh_CN.ck \
95 zh_TW.UTF-8.ck \
96 zh_TW.ck \
97 cs.cp1250.ck \
98 ja.sjis.ck \
99 pl.cp1250.ck \
Bram Moolenaar910f66f2006-04-05 20:41:53 +0000100 pl.UTF-8.ck \
Bram Moolenaar58d98232005-07-23 22:25:46 +0000101 ru.cp1251.ck \
102 sk.cp1250.ck \
103 uk.cp1251.ck \
Bram Moolenaar78622822005-08-23 21:00:13 +0000104 zh_CN.cp936.ck
Bram Moolenaar58d98232005-07-23 22:25:46 +0000105
Bram Moolenaar071d4272004-06-13 20:20:40 +0000106PACKAGE = vim
107SHELL = /bin/sh
Bram Moolenaar58d98232005-07-23 22:25:46 +0000108VIM = ../vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000109
110# The OLD_PO_FILE_INPUT and OLD_PO_FILE_OUTPUT are for the new GNU gettext
111# tools 0.10.37, which use a slightly different .po file format that is not
112# compatible with Solaris (and old gettext implementations) unless these are
113# set. gettext 0.10.36 will not work!
114MSGFMT = OLD_PO_FILE_INPUT=yes msgfmt -v
115XGETTEXT = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes xgettext
116MSGMERGE = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes msgmerge
117
118.SUFFIXES:
Bram Moolenaar58d98232005-07-23 22:25:46 +0000119.SUFFIXES: .po .mo .pot .ck
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000120.PHONY: all install uninstall prefixcheck converted check clean checkclean distclean update-po $(LANGUAGES)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000121
122.po.mo:
123 $(MSGFMT) -o $@ $<
124
Bram Moolenaar58d98232005-07-23 22:25:46 +0000125.po.ck:
126 $(VIM) -u NONE -e -S check.vim -c "if error == 0 | q | endif" -c cq $<
127 touch $@
128
Bram Moolenaar071d4272004-06-13 20:20:40 +0000129all: $(MOFILES)
130
Bram Moolenaar58d98232005-07-23 22:25:46 +0000131check: $(CHECKFILES)
132
Bram Moolenaar071d4272004-06-13 20:20:40 +0000133install: $(MOFILES)
Bram Moolenaar58d98232005-07-23 22:25:46 +0000134 @$(MAKE) prefixcheck
Bram Moolenaar071d4272004-06-13 20:20:40 +0000135 for lang in $(LANGUAGES); do \
136 dir=$(LOCALEDIR)/$$lang/; \
137 if test ! -x "$$dir"; then \
138 mkdir $$dir; chmod 755 $$dir; \
139 fi; \
140 dir=$(LOCALEDIR)/$$lang/LC_MESSAGES; \
141 if test ! -x "$$dir"; then \
142 mkdir $$dir; chmod 755 $$dir; \
143 fi; \
144 if test -r $$lang.mo; then \
145 $(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \
146 chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \
147 fi; \
148 done
149
150uninstall:
Bram Moolenaar58d98232005-07-23 22:25:46 +0000151 @$(MAKE) prefixcheck
Bram Moolenaar071d4272004-06-13 20:20:40 +0000152 for cat in $(MOFILES); do \
153 cat=`basename $$cat`; \
154 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
155 rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
156 done
157
Bram Moolenaar58d98232005-07-23 22:25:46 +0000158converted: $(CONVERTED)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000159
160# Convert ja.po to create ja.sjis.po. Requires doubling backslashes in the
161# second byte. Don't depend on sjiscorr, it should only be compiled when
162# ja.sjis.po is outdated.
163ja.sjis.po: ja.po
164 @$(MAKE) sjiscorr
165 rm -f ja.sjis.po
166 iconv -f euc-jp -t cp932 ja.po | ./sjiscorr > ja.sjis.po
167
168sjiscorr: sjiscorr.c
169 $(CC) -o sjiscorr sjiscorr.c
170
171# Convert cs.po to create cs.cp1250.po.
172cs.cp1250.po: cs.po
173 rm -f cs.cp1250.po
174 iconv -f iso-8859-2 -t cp1250 cs.po | \
175 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' > cs.cp1250.po
176
177# Convert pl.po to create pl.cp1250.po.
178pl.cp1250.po: pl.po
179 rm -f pl.cp1250.po
180 iconv -f iso-8859-2 -t cp1250 pl.po | \
181 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.cp1250.po
182
Bram Moolenaar910f66f2006-04-05 20:41:53 +0000183# Convert pl.po to create pl.UTF-8.po.
184pl.UTF-8.po: pl.po
185 rm -f pl.UTF-8.po
186 iconv -f iso-8859-2 -t utf-8 pl.po | \
187 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
188
Bram Moolenaar071d4272004-06-13 20:20:40 +0000189# Convert sk.po to create sk.cp1250.po.
190sk.cp1250.po: sk.po
191 rm -f sk.cp1250.po
192 iconv -f iso-8859-2 -t cp1250 sk.po | \
193 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' > sk.cp1250.po
194
195# Convert zh_CN.po to create zh_CN.cp936.po.
196# set 'charset' to gbk to avoid that msfmt generates a warning
197zh_CN.cp936.po: zh_CN.po
198 rm -f zh_CN.cp936.po
199 iconv -f gb2312 -t cp936 zh_CN.po | \
200 sed -e 's/charset=gb2312/charset=gbk/' -e 's/# Original translations/# Generated from zh_CN.po, DO NOT EDIT/' > zh_CN.cp936.po
201
202# Convert ru.po to create ru.cp1251.po.
203ru.cp1251.po: ru.po
204 rm -f ru.cp1251.po
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000205 iconv -f utf-8 -t cp1251 ru.po | \
206 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 +0000207
Bram Moolenaar15d0a8c2004-09-06 17:44:46 +0000208# Convert uk.po to create uk.cp1251.po.
209uk.cp1251.po: uk.po
210 rm -f uk.cp1251.po
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000211 iconv -f utf-8 -t cp1251 uk.po | \
212 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 +0000213
Bram Moolenaar58d98232005-07-23 22:25:46 +0000214prefixcheck:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000215 @if test "x" = "x$(prefix)"; then \
216 echo "******************************************"; \
217 echo " please use make from the src directory "; \
218 echo "******************************************"; \
219 exit 1; \
220 fi
221
Bram Moolenaar316059c2006-01-14 21:18:42 +0000222clean: checkclean
223 rm -f core core.* *.old.po *.mo *.pot sjiscorr
Bram Moolenaar071d4272004-06-13 20:20:40 +0000224
225distclean: clean
226
Bram Moolenaar316059c2006-01-14 21:18:42 +0000227checkclean:
228 rm -f *.ck
229
Bram Moolenaar071d4272004-06-13 20:20:40 +0000230#
231# NOTE: If you get an error for gvimext.cpp not found, you need to unpack the
232# extra archive.
233#
234$(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h
235 cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \
236 --add-comments --keyword=_ --keyword=N_ \
237 *.c if_perl.xs GvimExt/gvimext.cpp globals.h
238 mv -f ../$(PACKAGE).po $(PACKAGE).pot
239
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000240update-po: $(LANGUAGES)
241
Bram Moolenaar071d4272004-06-13 20:20:40 +0000242# Don't add a dependency here, we only want to update the .po files manually
243$(LANGUAGES):
244 @$(MAKE) $(PACKAGE).pot
245 if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi
246 mv $@.po $@.po.old
247 if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \
248 rm -f $@.po.old; \
249 else \
250 echo "msgmerge for $@.po failed!"; mv $@.po.old $@.po; \
251 fi