blob: 185bc2a023664bd75c12899163233fd46e190403 [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 \
59 ru.cp1251.mo \
60 sk.cp1250.mo \
61 uk.cp1251.mo \
Bram Moolenaar78622822005-08-23 21:00:13 +000062 zh_CN.cp936.mo
Bram Moolenaar58d98232005-07-23 22:25:46 +000063
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 \
Bram Moolenaar78622822005-08-23 21:00:13 +000093 zh_CN.cp936.ck
Bram Moolenaar58d98232005-07-23 22:25:46 +000094
Bram Moolenaar071d4272004-06-13 20:20:40 +000095PACKAGE = vim
96SHELL = /bin/sh
Bram Moolenaar58d98232005-07-23 22:25:46 +000097VIM = ../vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000098
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:
Bram Moolenaar58d98232005-07-23 22:25:46 +0000108.SUFFIXES: .po .mo .pot .ck
109.PHONY: all install uninstall prefixcheck check clean distclean $(LANGUAGES)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000110
111.po.mo:
112 $(MSGFMT) -o $@ $<
113
Bram Moolenaar58d98232005-07-23 22:25:46 +0000114.po.ck:
115 $(VIM) -u NONE -e -S check.vim -c "if error == 0 | q | endif" -c cq $<
116 touch $@
117
Bram Moolenaar071d4272004-06-13 20:20:40 +0000118all: $(MOFILES)
119
Bram Moolenaar58d98232005-07-23 22:25:46 +0000120check: $(CHECKFILES)
121
Bram Moolenaar071d4272004-06-13 20:20:40 +0000122install: $(MOFILES)
Bram Moolenaar58d98232005-07-23 22:25:46 +0000123 @$(MAKE) prefixcheck
Bram Moolenaar071d4272004-06-13 20:20:40 +0000124 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:
Bram Moolenaar58d98232005-07-23 22:25:46 +0000140 @$(MAKE) prefixcheck
Bram Moolenaar071d4272004-06-13 20:20:40 +0000141 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
Bram Moolenaar58d98232005-07-23 22:25:46 +0000147converted: $(CONVERTED)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000148
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
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000188 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000190
Bram Moolenaar15d0a8c2004-09-06 17:44:46 +0000191# 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
Bram Moolenaar58d98232005-07-23 22:25:46 +0000197prefixcheck:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000198 @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
Bram Moolenaar316059c2006-01-14 21:18:42 +0000205clean: checkclean
206 rm -f core core.* *.old.po *.mo *.pot sjiscorr
Bram Moolenaar071d4272004-06-13 20:20:40 +0000207
208distclean: clean
209
Bram Moolenaar316059c2006-01-14 21:18:42 +0000210checkclean:
211 rm -f *.ck
212
Bram Moolenaar071d4272004-06-13 20:20:40 +0000213#
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 $@.po failed!"; mv $@.po.old $@.po; \
232 fi