blob: d30d72ff4c4ab9c6ad20e70b7e785a3619ee8dd9 [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 \
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 \
Bram Moolenaar78622822005-08-23 21:00:13 +000029 zh_TW.UTF-8
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +000030
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 \
Bram Moolenaar78622822005-08-23 21:00:13 +000053 zh_TW.mo
Bram Moolenaar071d4272004-06-13 20:20:40 +000054
Bram Moolenaar58d98232005-07-23 22:25:46 +000055CONVERTED = \
56 cs.cp1250.mo \
57 ja.sjis.mo \
58 pl.cp1250.mo \
Bram Moolenaar910f66f2006-04-05 20:41:53 +000059 pl.UTF-8.mo \
Bram Moolenaar58d98232005-07-23 22:25:46 +000060 ru.cp1251.mo \
61 sk.cp1250.mo \
62 uk.cp1251.mo \
Bram Moolenaar78622822005-08-23 21:00:13 +000063 zh_CN.cp936.mo
Bram Moolenaar58d98232005-07-23 22:25:46 +000064
65CHECKFILES = \
66 af.ck \
67 ca.ck \
68 cs.ck \
69 de.ck \
70 en_GB.ck \
71 es.ck \
72 fr.ck \
73 ga.ck \
74 it.ck \
75 ja.ck \
76 ko.ck \
77 no.ck \
78 pl.ck \
79 ru.ck \
80 sk.ck \
81 sv.ck \
82 uk.ck \
83 vi.ck \
84 zh_CN.UTF-8.ck \
85 zh_CN.ck \
86 zh_TW.UTF-8.ck \
87 zh_TW.ck \
88 cs.cp1250.ck \
89 ja.sjis.ck \
90 pl.cp1250.ck \
Bram Moolenaar910f66f2006-04-05 20:41:53 +000091 pl.UTF-8.ck \
Bram Moolenaar58d98232005-07-23 22:25:46 +000092 ru.cp1251.ck \
93 sk.cp1250.ck \
94 uk.cp1251.ck \
Bram Moolenaar78622822005-08-23 21:00:13 +000095 zh_CN.cp936.ck
Bram Moolenaar58d98232005-07-23 22:25:46 +000096
Bram Moolenaar071d4272004-06-13 20:20:40 +000097PACKAGE = vim
98SHELL = /bin/sh
Bram Moolenaar58d98232005-07-23 22:25:46 +000099VIM = ../vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000100
101# The OLD_PO_FILE_INPUT and OLD_PO_FILE_OUTPUT are for the new GNU gettext
102# tools 0.10.37, which use a slightly different .po file format that is not
103# compatible with Solaris (and old gettext implementations) unless these are
104# set. gettext 0.10.36 will not work!
105MSGFMT = OLD_PO_FILE_INPUT=yes msgfmt -v
106XGETTEXT = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes xgettext
107MSGMERGE = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes msgmerge
108
109.SUFFIXES:
Bram Moolenaar58d98232005-07-23 22:25:46 +0000110.SUFFIXES: .po .mo .pot .ck
111.PHONY: all install uninstall prefixcheck check clean distclean $(LANGUAGES)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000112
113.po.mo:
114 $(MSGFMT) -o $@ $<
115
Bram Moolenaar58d98232005-07-23 22:25:46 +0000116.po.ck:
117 $(VIM) -u NONE -e -S check.vim -c "if error == 0 | q | endif" -c cq $<
118 touch $@
119
Bram Moolenaar071d4272004-06-13 20:20:40 +0000120all: $(MOFILES)
121
Bram Moolenaar58d98232005-07-23 22:25:46 +0000122check: $(CHECKFILES)
123
Bram Moolenaar071d4272004-06-13 20:20:40 +0000124install: $(MOFILES)
Bram Moolenaar58d98232005-07-23 22:25:46 +0000125 @$(MAKE) prefixcheck
Bram Moolenaar071d4272004-06-13 20:20:40 +0000126 for lang in $(LANGUAGES); do \
127 dir=$(LOCALEDIR)/$$lang/; \
128 if test ! -x "$$dir"; then \
129 mkdir $$dir; chmod 755 $$dir; \
130 fi; \
131 dir=$(LOCALEDIR)/$$lang/LC_MESSAGES; \
132 if test ! -x "$$dir"; then \
133 mkdir $$dir; chmod 755 $$dir; \
134 fi; \
135 if test -r $$lang.mo; then \
136 $(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \
137 chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \
138 fi; \
139 done
140
141uninstall:
Bram Moolenaar58d98232005-07-23 22:25:46 +0000142 @$(MAKE) prefixcheck
Bram Moolenaar071d4272004-06-13 20:20:40 +0000143 for cat in $(MOFILES); do \
144 cat=`basename $$cat`; \
145 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
146 rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
147 done
148
Bram Moolenaar58d98232005-07-23 22:25:46 +0000149converted: $(CONVERTED)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000150
151# Convert ja.po to create ja.sjis.po. Requires doubling backslashes in the
152# second byte. Don't depend on sjiscorr, it should only be compiled when
153# ja.sjis.po is outdated.
154ja.sjis.po: ja.po
155 @$(MAKE) sjiscorr
156 rm -f ja.sjis.po
157 iconv -f euc-jp -t cp932 ja.po | ./sjiscorr > ja.sjis.po
158
159sjiscorr: sjiscorr.c
160 $(CC) -o sjiscorr sjiscorr.c
161
162# Convert cs.po to create cs.cp1250.po.
163cs.cp1250.po: cs.po
164 rm -f cs.cp1250.po
165 iconv -f iso-8859-2 -t cp1250 cs.po | \
166 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' > cs.cp1250.po
167
168# Convert pl.po to create pl.cp1250.po.
169pl.cp1250.po: pl.po
170 rm -f pl.cp1250.po
171 iconv -f iso-8859-2 -t cp1250 pl.po | \
172 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.cp1250.po
173
Bram Moolenaar910f66f2006-04-05 20:41:53 +0000174# Convert pl.po to create pl.UTF-8.po.
175pl.UTF-8.po: pl.po
176 rm -f pl.UTF-8.po
177 iconv -f iso-8859-2 -t utf-8 pl.po | \
178 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
179
Bram Moolenaar071d4272004-06-13 20:20:40 +0000180# Convert sk.po to create sk.cp1250.po.
181sk.cp1250.po: sk.po
182 rm -f sk.cp1250.po
183 iconv -f iso-8859-2 -t cp1250 sk.po | \
184 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' > sk.cp1250.po
185
186# Convert zh_CN.po to create zh_CN.cp936.po.
187# set 'charset' to gbk to avoid that msfmt generates a warning
188zh_CN.cp936.po: zh_CN.po
189 rm -f zh_CN.cp936.po
190 iconv -f gb2312 -t cp936 zh_CN.po | \
191 sed -e 's/charset=gb2312/charset=gbk/' -e 's/# Original translations/# Generated from zh_CN.po, DO NOT EDIT/' > zh_CN.cp936.po
192
193# Convert ru.po to create ru.cp1251.po.
194ru.cp1251.po: ru.po
195 rm -f ru.cp1251.po
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000196 iconv -f utf-8 -t cp1251 ru.po | \
197 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 +0000198
Bram Moolenaar15d0a8c2004-09-06 17:44:46 +0000199# Convert uk.po to create uk.cp1251.po.
200uk.cp1251.po: uk.po
201 rm -f uk.cp1251.po
202 iconv -f koi8-u -t cp1251 uk.po | \
203 sed -e 's/charset=koi8-u/charset=cp1251/' -e 's/# Original translations/# Generated from uk.po, DO NOT EDIT/' > uk.cp1251.po
204
Bram Moolenaar58d98232005-07-23 22:25:46 +0000205prefixcheck:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000206 @if test "x" = "x$(prefix)"; then \
207 echo "******************************************"; \
208 echo " please use make from the src directory "; \
209 echo "******************************************"; \
210 exit 1; \
211 fi
212
Bram Moolenaar316059c2006-01-14 21:18:42 +0000213clean: checkclean
214 rm -f core core.* *.old.po *.mo *.pot sjiscorr
Bram Moolenaar071d4272004-06-13 20:20:40 +0000215
216distclean: clean
217
Bram Moolenaar316059c2006-01-14 21:18:42 +0000218checkclean:
219 rm -f *.ck
220
Bram Moolenaar071d4272004-06-13 20:20:40 +0000221#
222# NOTE: If you get an error for gvimext.cpp not found, you need to unpack the
223# extra archive.
224#
225$(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h
226 cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \
227 --add-comments --keyword=_ --keyword=N_ \
228 *.c if_perl.xs GvimExt/gvimext.cpp globals.h
229 mv -f ../$(PACKAGE).po $(PACKAGE).pot
230
231# Don't add a dependency here, we only want to update the .po files manually
232$(LANGUAGES):
233 @$(MAKE) $(PACKAGE).pot
234 if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi
235 mv $@.po $@.po.old
236 if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \
237 rm -f $@.po.old; \
238 else \
239 echo "msgmerge for $@.po failed!"; mv $@.po.old $@.po; \
240 fi