blob: 70f7fc8367bb6762a11986c681edc5c03d4b80dd [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001# Makefile for the Vim message translations.
2
Bram Moolenaare639eb42014-06-12 18:03:29 +02003# Include stuff found by configure.
4include ../auto/config.mk
5
Bram Moolenaara4a29342018-06-24 15:52:56 +02006# get LANGUAGES, MOFILES, MOCONVERTED and CHECKFILES
7include Make_all.mak
8
Bram Moolenaar071d4272004-06-13 20:20:40 +00009# Note: ja.sjis, *.cp1250 and zh_CN.cp936 are only for MS-Windows, they are
10# not installed on Unix
11
Bram Moolenaar071d4272004-06-13 20:20:40 +000012PACKAGE = vim
13SHELL = /bin/sh
Bram Moolenaar58d98232005-07-23 22:25:46 +000014VIM = ../vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000015
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!
Bram Moolenaare639eb42014-06-12 18:03:29 +020020MSGFMTCMD = OLD_PO_FILE_INPUT=yes $(MSGFMT) -v
Bram Moolenaar071d4272004-06-13 20:20:40 +000021XGETTEXT = 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:
Bram Moolenaar58d98232005-07-23 22:25:46 +000025.SUFFIXES: .po .mo .pot .ck
Bram Moolenaara4a29342018-06-24 15:52:56 +020026.PHONY: all install uninstall prefixcheck converted check clean checkclean distclean update-po $(LANGUAGES)
Bram Moolenaar071d4272004-06-13 20:20:40 +000027
Bram Moolenaara60e5362019-04-11 13:11:39 +020028LINGUAS:
29 @echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS
30
Bram Moolenaar071d4272004-06-13 20:20:40 +000031.po.mo:
Bram Moolenaare639eb42014-06-12 18:03:29 +020032 $(MSGFMTCMD) -o $@ $<
Bram Moolenaar071d4272004-06-13 20:20:40 +000033
Bram Moolenaar58d98232005-07-23 22:25:46 +000034.po.ck:
Bram Moolenaar28c37952010-01-06 20:29:28 +010035 $(VIM) -u NONE -e -X -S check.vim -c "if error == 0 | q | endif" -c cq $<
Bram Moolenaar58d98232005-07-23 22:25:46 +000036 touch $@
37
Bram Moolenaara60e5362019-04-11 13:11:39 +020038all: $(MOFILES) $(MOCONVERTED) gvim.desktop vim.desktop
Bram Moolenaar071d4272004-06-13 20:20:40 +000039
Bram Moolenaar58d98232005-07-23 22:25:46 +000040check: $(CHECKFILES)
41
Bram Moolenaarc4fba6f2013-01-17 13:37:32 +010042install: $(MOFILES) $(MOCONVERTED)
Bram Moolenaar58d98232005-07-23 22:25:46 +000043 @$(MAKE) prefixcheck
Bram Moolenaara4a29342018-06-24 15:52:56 +020044 for lang in $(LANGUAGES); do \
Bram Moolenaar071d4272004-06-13 20:20:40 +000045 dir=$(LOCALEDIR)/$$lang/; \
46 if test ! -x "$$dir"; then \
47 mkdir $$dir; chmod 755 $$dir; \
48 fi; \
49 dir=$(LOCALEDIR)/$$lang/LC_MESSAGES; \
50 if test ! -x "$$dir"; then \
51 mkdir $$dir; chmod 755 $$dir; \
52 fi; \
53 if test -r $$lang.mo; then \
54 $(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \
55 chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \
56 fi; \
57 done
58
59uninstall:
Bram Moolenaar58d98232005-07-23 22:25:46 +000060 @$(MAKE) prefixcheck
Bram Moolenaarc4fba6f2013-01-17 13:37:32 +010061 for cat in $(MOFILES) $(MOCONVERTED); do \
Bram Moolenaar071d4272004-06-13 20:20:40 +000062 cat=`basename $$cat`; \
63 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
64 rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
65 done
66
Bram Moolenaarc4fba6f2013-01-17 13:37:32 +010067converted: $(MOCONVERTED)
Bram Moolenaar071d4272004-06-13 20:20:40 +000068
Bram Moolenaar02938a92013-05-04 03:37:10 +020069# nl.po was added later, if it does not exist use a file with just a # in it
70# (an empty file doesn't work with old msgfmt).
Bram Moolenaar8d616172013-01-30 12:50:56 +010071nl.po:
Bram Moolenaar02938a92013-05-04 03:37:10 +020072 @( echo \# > nl.po )
Bram Moolenaar8d616172013-01-30 12:50:56 +010073
Bram Moolenaar28c37952010-01-06 20:29:28 +010074# Norwegian/Bokmal: "nb" is an alias for "no".
75# Copying the file is not efficient, but I don't know of another way to make
76# this work.
77nb.po: no.po
78 cp no.po nb.po
79
Bram Moolenaar071d4272004-06-13 20:20:40 +000080# Convert ja.po to create ja.sjis.po. Requires doubling backslashes in the
81# second byte. Don't depend on sjiscorr, it should only be compiled when
82# ja.sjis.po is outdated.
83ja.sjis.po: ja.po
84 @$(MAKE) sjiscorr
85 rm -f ja.sjis.po
Bram Moolenaare6ae6222013-05-21 21:01:10 +020086 iconv -f utf-8 -t cp932 ja.po | ./sjiscorr > ja.sjis.po
Bram Moolenaar071d4272004-06-13 20:20:40 +000087
88sjiscorr: sjiscorr.c
89 $(CC) -o sjiscorr sjiscorr.c
90
Bram Moolenaare6ae6222013-05-21 21:01:10 +020091ja.euc-jp.po: ja.po
92 iconv -f utf-8 -t euc-jp ja.po | \
Bram Moolenaard1d037e2018-06-24 18:04:50 +020093 sed -e 's/charset=[uU][tT][fF]-8/charset=euc-jp/' -e 's/# Original translations/# Generated from ja.po, DO NOT EDIT/' > ja.euc-jp.po
Bram Moolenaare6ae6222013-05-21 21:01:10 +020094
Bram Moolenaar071d4272004-06-13 20:20:40 +000095# Convert cs.po to create cs.cp1250.po.
96cs.cp1250.po: cs.po
97 rm -f cs.cp1250.po
98 iconv -f iso-8859-2 -t cp1250 cs.po | \
99 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' > cs.cp1250.po
100
101# Convert pl.po to create pl.cp1250.po.
102pl.cp1250.po: pl.po
103 rm -f pl.cp1250.po
104 iconv -f iso-8859-2 -t cp1250 pl.po | \
105 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.cp1250.po
106
Bram Moolenaar910f66f2006-04-05 20:41:53 +0000107# Convert pl.po to create pl.UTF-8.po.
108pl.UTF-8.po: pl.po
109 rm -f pl.UTF-8.po
110 iconv -f iso-8859-2 -t utf-8 pl.po | \
Bram Moolenaard1d037e2018-06-24 18:04:50 +0200111 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
Bram Moolenaar910f66f2006-04-05 20:41:53 +0000112
Bram Moolenaar071d4272004-06-13 20:20:40 +0000113# Convert sk.po to create sk.cp1250.po.
114sk.cp1250.po: sk.po
115 rm -f sk.cp1250.po
116 iconv -f iso-8859-2 -t cp1250 sk.po | \
117 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' > sk.cp1250.po
118
Bram Moolenaar16038d52017-01-27 20:37:49 +0100119# Convert zh_CN.UTF-8.po to create zh_CN.cp936.po.
120# Set 'charset' to gbk to avoid that msfmt generates a warning.
121# This used to convert from zh_CN.po, but that results in a conversion error.
122zh_CN.cp936.po: zh_CN.UTF-8.po
Bram Moolenaar071d4272004-06-13 20:20:40 +0000123 rm -f zh_CN.cp936.po
Bram Moolenaar16038d52017-01-27 20:37:49 +0100124 iconv -f UTF-8 -t cp936 zh_CN.UTF-8.po | \
Bram Moolenaard1d037e2018-06-24 18:04:50 +0200125 sed -e 's/charset=[uU][tT][fF]-8/charset=gbk/' -e 's/# Original translations/# Generated from zh_CN.UTF-8.po, DO NOT EDIT/' > zh_CN.cp936.po
Bram Moolenaar071d4272004-06-13 20:20:40 +0000126
Bram Moolenaar5e3dae82010-03-02 16:19:40 +0100127# Convert ko.UTF-8.po to create ko.po.
128ko.po: ko.UTF-8.po
129 rm -f ko.po
130 iconv -f UTF-8 -t euc-kr ko.UTF-8.po | \
131 sed -e 's/charset=UTF-8/charset=euc-kr/' \
132 -e 's/# Korean translation for Vim/# Generated from ko.UTF-8.po, DO NOT EDIT/' \
133 > ko.po
134
Bram Moolenaar071d4272004-06-13 20:20:40 +0000135# Convert ru.po to create ru.cp1251.po.
136ru.cp1251.po: ru.po
137 rm -f ru.cp1251.po
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000138 iconv -f utf-8 -t cp1251 ru.po | \
Bram Moolenaara4a29342018-06-24 15:52:56 +0200139 sed -e 's/charset=[uU][tT][fF]-8/charset=cp1251/' -e 's/# Original translations/# Generated from ru.po, DO NOT EDIT/' > ru.cp1251.po
Bram Moolenaar071d4272004-06-13 20:20:40 +0000140
Bram Moolenaar15d0a8c2004-09-06 17:44:46 +0000141# Convert uk.po to create uk.cp1251.po.
142uk.cp1251.po: uk.po
143 rm -f uk.cp1251.po
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000144 iconv -f utf-8 -t cp1251 uk.po | \
Bram Moolenaara4a29342018-06-24 15:52:56 +0200145 sed -e 's/charset=[uU][tT][fF]-8/charset=cp1251/' -e 's/# Original translations/# Generated from uk.po, DO NOT EDIT/' > uk.cp1251.po
Bram Moolenaar15d0a8c2004-09-06 17:44:46 +0000146
Bram Moolenaar58d98232005-07-23 22:25:46 +0000147prefixcheck:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000148 @if test "x" = "x$(prefix)"; then \
149 echo "******************************************"; \
150 echo " please use make from the src directory "; \
151 echo "******************************************"; \
152 exit 1; \
153 fi
154
Bram Moolenaar316059c2006-01-14 21:18:42 +0000155clean: checkclean
156 rm -f core core.* *.old.po *.mo *.pot sjiscorr
Bram Moolenaar071d4272004-06-13 20:20:40 +0000157
158distclean: clean
159
Bram Moolenaar316059c2006-01-14 21:18:42 +0000160checkclean:
161 rm -f *.ck
162
Bram Moolenaara60e5362019-04-11 13:11:39 +0200163$(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h ../if_py_both.h ../vim.h gvim.desktop.in vim.desktop.in
Bram Moolenaar071d4272004-06-13 20:20:40 +0000164 cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \
Bram Moolenaar228de1d2018-03-14 20:11:12 +0100165 --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 \
Bram Moolenaara60e5362019-04-11 13:11:39 +0200166 *.c if_perl.xs GvimExt/gvimext.cpp globals.h if_py_both.h vim.h \
167 po/gvim.desktop.in po/vim.desktop.in
Bram Moolenaar071d4272004-06-13 20:20:40 +0000168 mv -f ../$(PACKAGE).po $(PACKAGE).pot
169
Bram Moolenaara60e5362019-04-11 13:11:39 +0200170%.desktop: %.desktop.in $(PACKAGE).pot LINGUAS
171 $(MSGFMT) --desktop -d . --template $< -o $@
172 cp -f $@ ../../runtime/$@
173
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000174update-po: $(LANGUAGES)
175
Bram Moolenaar071d4272004-06-13 20:20:40 +0000176# Don't add a dependency here, we only want to update the .po files manually
177$(LANGUAGES):
178 @$(MAKE) $(PACKAGE).pot
179 if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi
180 mv $@.po $@.po.old
181 if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \
182 rm -f $@.po.old; \
183 else \
184 echo "msgmerge for $@.po failed!"; mv $@.po.old $@.po; \
185 fi