blob: 2b7eae068995f64047ef14ac171d9b845a678c3b [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 \
23 ru \
24 sk \
25 sv \
26 uk \
27 vi \
28 zh_CN \
29 zh_CN.UTF-8 \
30 zh_TW \
Bram Moolenaar78622822005-08-23 21:00:13 +000031 zh_TW.UTF-8
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000032
33MOFILES = \
34 af.mo \
35 ca.mo \
36 cs.mo \
37 de.mo \
38 en_GB.mo \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000039 eo.mo \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000040 es.mo \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000041 fi.mo \
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000042 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 \
Bram Moolenaar78622822005-08-23 21:00:13 +000057 zh_TW.mo
Bram Moolenaar071d4272004-06-13 20:20:40 +000058
Bram Moolenaar58d98232005-07-23 22:25:46 +000059CONVERTED = \
60 cs.cp1250.mo \
61 ja.sjis.mo \
62 pl.cp1250.mo \
Bram Moolenaar910f66f2006-04-05 20:41:53 +000063 pl.UTF-8.mo \
Bram Moolenaar58d98232005-07-23 22:25:46 +000064 ru.cp1251.mo \
65 sk.cp1250.mo \
66 uk.cp1251.mo \
Bram Moolenaar78622822005-08-23 21:00:13 +000067 zh_CN.cp936.mo
Bram Moolenaar58d98232005-07-23 22:25:46 +000068
69CHECKFILES = \
70 af.ck \
71 ca.ck \
72 cs.ck \
73 de.ck \
74 en_GB.ck \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000075 eo.ck \
Bram Moolenaar58d98232005-07-23 22:25:46 +000076 es.ck \
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000077 fi.ck \
Bram Moolenaar58d98232005-07-23 22:25:46 +000078 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 \
Bram Moolenaar910f66f2006-04-05 20:41:53 +000097 pl.UTF-8.ck \
Bram Moolenaar58d98232005-07-23 22:25:46 +000098 ru.cp1251.ck \
99 sk.cp1250.ck \
100 uk.cp1251.ck \
Bram Moolenaar78622822005-08-23 21:00:13 +0000101 zh_CN.cp936.ck
Bram Moolenaar58d98232005-07-23 22:25:46 +0000102
Bram Moolenaar071d4272004-06-13 20:20:40 +0000103PACKAGE = vim
104SHELL = /bin/sh
Bram Moolenaar58d98232005-07-23 22:25:46 +0000105VIM = ../vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000106
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:
Bram Moolenaar58d98232005-07-23 22:25:46 +0000116.SUFFIXES: .po .mo .pot .ck
117.PHONY: all install uninstall prefixcheck check clean distclean $(LANGUAGES)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000118
119.po.mo:
120 $(MSGFMT) -o $@ $<
121
Bram Moolenaar58d98232005-07-23 22:25:46 +0000122.po.ck:
123 $(VIM) -u NONE -e -S check.vim -c "if error == 0 | q | endif" -c cq $<
124 touch $@
125
Bram Moolenaar071d4272004-06-13 20:20:40 +0000126all: $(MOFILES)
127
Bram Moolenaar58d98232005-07-23 22:25:46 +0000128check: $(CHECKFILES)
129
Bram Moolenaar071d4272004-06-13 20:20:40 +0000130install: $(MOFILES)
Bram Moolenaar58d98232005-07-23 22:25:46 +0000131 @$(MAKE) prefixcheck
Bram Moolenaar071d4272004-06-13 20:20:40 +0000132 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:
Bram Moolenaar58d98232005-07-23 22:25:46 +0000148 @$(MAKE) prefixcheck
Bram Moolenaar071d4272004-06-13 20:20:40 +0000149 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
Bram Moolenaar58d98232005-07-23 22:25:46 +0000155converted: $(CONVERTED)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000156
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
Bram Moolenaar910f66f2006-04-05 20:41:53 +0000180# 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000186# 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
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000202 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000204
Bram Moolenaar15d0a8c2004-09-06 17:44:46 +0000205# Convert uk.po to create uk.cp1251.po.
206uk.cp1251.po: uk.po
207 rm -f uk.cp1251.po
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000208 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
Bram Moolenaar15d0a8c2004-09-06 17:44:46 +0000210
Bram Moolenaar58d98232005-07-23 22:25:46 +0000211prefixcheck:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000212 @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
Bram Moolenaar316059c2006-01-14 21:18:42 +0000219clean: checkclean
220 rm -f core core.* *.old.po *.mo *.pot sjiscorr
Bram Moolenaar071d4272004-06-13 20:20:40 +0000221
222distclean: clean
223
Bram Moolenaar316059c2006-01-14 21:18:42 +0000224checkclean:
225 rm -f *.ck
226
Bram Moolenaar071d4272004-06-13 20:20:40 +0000227#
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 $@.po failed!"; mv $@.po.old $@.po; \
246 fi