blob: d54913062b033c7ebbb2083192005fd5aed14181 [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
7LANGUAGES = af ca cs de en_GB es fr it ja ko no pl ru sk sv uk zh_TW \
8 zh_TW.UTF-8 zh_CN zh_CN.UTF-8
9MOFILES = af.mo ca.mo cs.mo de.mo en_GB.mo es.mo fr.mo it.mo ja.mo \
10 ko.mo no.mo pl.mo ru.mo sk.mo sv.mo uk.mo \
11 zh_TW.mo zh_TW.UTF-8.mo zh_CN.mo zh_CN.UTF-8.mo
12
13PACKAGE = vim
14SHELL = /bin/sh
15
16# The OLD_PO_FILE_INPUT and OLD_PO_FILE_OUTPUT are for the new GNU gettext
17# tools 0.10.37, which use a slightly different .po file format that is not
18# compatible with Solaris (and old gettext implementations) unless these are
19# set. gettext 0.10.36 will not work!
20MSGFMT = OLD_PO_FILE_INPUT=yes msgfmt -v
21XGETTEXT = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes xgettext
22MSGMERGE = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes msgmerge
23
24.SUFFIXES:
25.SUFFIXES: .po .mo .pot
26.PHONY: all install uninstall check clean distclean $(LANGUAGES)
27
28.po.mo:
29 $(MSGFMT) -o $@ $<
30
31all: $(MOFILES)
32
33install: $(MOFILES)
34 @$(MAKE) check
35 for lang in $(LANGUAGES); do \
36 dir=$(LOCALEDIR)/$$lang/; \
37 if test ! -x "$$dir"; then \
38 mkdir $$dir; chmod 755 $$dir; \
39 fi; \
40 dir=$(LOCALEDIR)/$$lang/LC_MESSAGES; \
41 if test ! -x "$$dir"; then \
42 mkdir $$dir; chmod 755 $$dir; \
43 fi; \
44 if test -r $$lang.mo; then \
45 $(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \
46 chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \
47 fi; \
48 done
49
50uninstall:
51 @$(MAKE) check
52 for cat in $(MOFILES); do \
53 cat=`basename $$cat`; \
54 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
55 rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
56 done
57
58converted: ja.sjis.mo cs.cp1250.mo pl.cp1250.mo sk.cp1250.mo zh_CN.cp936.mo \
59 ru.cp1251.mo
60
61# Convert ja.po to create ja.sjis.po. Requires doubling backslashes in the
62# second byte. Don't depend on sjiscorr, it should only be compiled when
63# ja.sjis.po is outdated.
64ja.sjis.po: ja.po
65 @$(MAKE) sjiscorr
66 rm -f ja.sjis.po
67 iconv -f euc-jp -t cp932 ja.po | ./sjiscorr > ja.sjis.po
68
69sjiscorr: sjiscorr.c
70 $(CC) -o sjiscorr sjiscorr.c
71
72# Convert cs.po to create cs.cp1250.po.
73cs.cp1250.po: cs.po
74 rm -f cs.cp1250.po
75 iconv -f iso-8859-2 -t cp1250 cs.po | \
76 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' > cs.cp1250.po
77
78# Convert pl.po to create pl.cp1250.po.
79pl.cp1250.po: pl.po
80 rm -f pl.cp1250.po
81 iconv -f iso-8859-2 -t cp1250 pl.po | \
82 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.cp1250.po
83
84# Convert sk.po to create sk.cp1250.po.
85sk.cp1250.po: sk.po
86 rm -f sk.cp1250.po
87 iconv -f iso-8859-2 -t cp1250 sk.po | \
88 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' > sk.cp1250.po
89
90# Convert zh_CN.po to create zh_CN.cp936.po.
91# set 'charset' to gbk to avoid that msfmt generates a warning
92zh_CN.cp936.po: zh_CN.po
93 rm -f zh_CN.cp936.po
94 iconv -f gb2312 -t cp936 zh_CN.po | \
95 sed -e 's/charset=gb2312/charset=gbk/' -e 's/# Original translations/# Generated from zh_CN.po, DO NOT EDIT/' > zh_CN.cp936.po
96
97# Convert ru.po to create ru.cp1251.po.
98ru.cp1251.po: ru.po
99 rm -f ru.cp1251.po
100 iconv -f koi8-r -t cp1251 ru.po | \
101 sed -e 's/charset=koi8-r/charset=cp1251/' -e 's/# Original translations/# Generated from ru.po, DO NOT EDIT/' > ru.cp1251.po
102
103check:
104 @if test "x" = "x$(prefix)"; then \
105 echo "******************************************"; \
106 echo " please use make from the src directory "; \
107 echo "******************************************"; \
108 exit 1; \
109 fi
110
111clean:
112 rm -f core core.* *.old.po *.mo *.pot sjiscorr
113
114distclean: clean
115
116#
117# NOTE: If you get an error for gvimext.cpp not found, you need to unpack the
118# extra archive.
119#
120$(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h
121 cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \
122 --add-comments --keyword=_ --keyword=N_ \
123 *.c if_perl.xs GvimExt/gvimext.cpp globals.h
124 mv -f ../$(PACKAGE).po $(PACKAGE).pot
125
126# Don't add a dependency here, we only want to update the .po files manually
127$(LANGUAGES):
128 @$(MAKE) $(PACKAGE).pot
129 if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi
130 mv $@.po $@.po.old
131 if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \
132 rm -f $@.po.old; \
133 else \
134 echo "msgmerge for $@.po failed!"; mv $@.po.old $@.po; \
135 fi