blob: 7320a605da9c87ab779e3a0711af7ce6cf98073c [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 \
29 zh_TW.UTF-8 \
30
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 \
53 zh_TW.mo \
Bram Moolenaar071d4272004-06-13 20:20:40 +000054
55PACKAGE = vim
56SHELL = /bin/sh
57
58# The OLD_PO_FILE_INPUT and OLD_PO_FILE_OUTPUT are for the new GNU gettext
59# tools 0.10.37, which use a slightly different .po file format that is not
60# compatible with Solaris (and old gettext implementations) unless these are
61# set. gettext 0.10.36 will not work!
62MSGFMT = OLD_PO_FILE_INPUT=yes msgfmt -v
63XGETTEXT = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes xgettext
64MSGMERGE = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes msgmerge
65
66.SUFFIXES:
67.SUFFIXES: .po .mo .pot
68.PHONY: all install uninstall check clean distclean $(LANGUAGES)
69
70.po.mo:
71 $(MSGFMT) -o $@ $<
72
73all: $(MOFILES)
74
75install: $(MOFILES)
76 @$(MAKE) check
77 for lang in $(LANGUAGES); do \
78 dir=$(LOCALEDIR)/$$lang/; \
79 if test ! -x "$$dir"; then \
80 mkdir $$dir; chmod 755 $$dir; \
81 fi; \
82 dir=$(LOCALEDIR)/$$lang/LC_MESSAGES; \
83 if test ! -x "$$dir"; then \
84 mkdir $$dir; chmod 755 $$dir; \
85 fi; \
86 if test -r $$lang.mo; then \
87 $(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \
88 chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \
89 fi; \
90 done
91
92uninstall:
93 @$(MAKE) check
94 for cat in $(MOFILES); do \
95 cat=`basename $$cat`; \
96 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
97 rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
98 done
99
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +0000100converted: \
101 cs.cp1250.mo \
102 ja.sjis.mo \
103 pl.cp1250.mo \
104 ru.cp1251.mo \
105 sk.cp1250.mo \
106 uk.cp1251.mo \
107 zh_CN.cp936.mo \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000108
109# Convert ja.po to create ja.sjis.po. Requires doubling backslashes in the
110# second byte. Don't depend on sjiscorr, it should only be compiled when
111# ja.sjis.po is outdated.
112ja.sjis.po: ja.po
113 @$(MAKE) sjiscorr
114 rm -f ja.sjis.po
115 iconv -f euc-jp -t cp932 ja.po | ./sjiscorr > ja.sjis.po
116
117sjiscorr: sjiscorr.c
118 $(CC) -o sjiscorr sjiscorr.c
119
120# Convert cs.po to create cs.cp1250.po.
121cs.cp1250.po: cs.po
122 rm -f cs.cp1250.po
123 iconv -f iso-8859-2 -t cp1250 cs.po | \
124 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' > cs.cp1250.po
125
126# Convert pl.po to create pl.cp1250.po.
127pl.cp1250.po: pl.po
128 rm -f pl.cp1250.po
129 iconv -f iso-8859-2 -t cp1250 pl.po | \
130 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.cp1250.po
131
132# Convert sk.po to create sk.cp1250.po.
133sk.cp1250.po: sk.po
134 rm -f sk.cp1250.po
135 iconv -f iso-8859-2 -t cp1250 sk.po | \
136 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' > sk.cp1250.po
137
138# Convert zh_CN.po to create zh_CN.cp936.po.
139# set 'charset' to gbk to avoid that msfmt generates a warning
140zh_CN.cp936.po: zh_CN.po
141 rm -f zh_CN.cp936.po
142 iconv -f gb2312 -t cp936 zh_CN.po | \
143 sed -e 's/charset=gb2312/charset=gbk/' -e 's/# Original translations/# Generated from zh_CN.po, DO NOT EDIT/' > zh_CN.cp936.po
144
145# Convert ru.po to create ru.cp1251.po.
146ru.cp1251.po: ru.po
147 rm -f ru.cp1251.po
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000148 iconv -f utf-8 -t cp1251 ru.po | \
149 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 +0000150
Bram Moolenaar15d0a8c2004-09-06 17:44:46 +0000151# Convert uk.po to create uk.cp1251.po.
152uk.cp1251.po: uk.po
153 rm -f uk.cp1251.po
154 iconv -f koi8-u -t cp1251 uk.po | \
155 sed -e 's/charset=koi8-u/charset=cp1251/' -e 's/# Original translations/# Generated from uk.po, DO NOT EDIT/' > uk.cp1251.po
156
Bram Moolenaar071d4272004-06-13 20:20:40 +0000157check:
158 @if test "x" = "x$(prefix)"; then \
159 echo "******************************************"; \
160 echo " please use make from the src directory "; \
161 echo "******************************************"; \
162 exit 1; \
163 fi
164
165clean:
166 rm -f core core.* *.old.po *.mo *.pot sjiscorr
167
168distclean: clean
169
170#
171# NOTE: If you get an error for gvimext.cpp not found, you need to unpack the
172# extra archive.
173#
174$(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h
175 cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \
176 --add-comments --keyword=_ --keyword=N_ \
177 *.c if_perl.xs GvimExt/gvimext.cpp globals.h
178 mv -f ../$(PACKAGE).po $(PACKAGE).pot
179
180# Don't add a dependency here, we only want to update the .po files manually
181$(LANGUAGES):
182 @$(MAKE) $(PACKAGE).pot
183 if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi
184 mv $@.po $@.po.old
185 if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \
186 rm -f $@.po.old; \
187 else \
188 echo "msgmerge for $@.po failed!"; mv $@.po.old $@.po; \
189 fi