blob: 8ef93e6eb0fc52b6b41a8f3b200814bae84f45ba [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
28.po.mo:
Bram Moolenaare639eb42014-06-12 18:03:29 +020029 $(MSGFMTCMD) -o $@ $<
Bram Moolenaar071d4272004-06-13 20:20:40 +000030
Bram Moolenaar58d98232005-07-23 22:25:46 +000031.po.ck:
Bram Moolenaar28c37952010-01-06 20:29:28 +010032 $(VIM) -u NONE -e -X -S check.vim -c "if error == 0 | q | endif" -c cq $<
Bram Moolenaar58d98232005-07-23 22:25:46 +000033 touch $@
34
Bram Moolenaar26096cc2019-04-11 15:25:40 +020035all: $(MOFILES) $(MOCONVERTED) $(MSGFMT_DESKTOP)
Bram Moolenaar071d4272004-06-13 20:20:40 +000036
Bram Moolenaar58d98232005-07-23 22:25:46 +000037check: $(CHECKFILES)
38
Bram Moolenaar0b39c3f2020-08-30 15:52:10 +020039# installing for real
Bram Moolenaarc4fba6f2013-01-17 13:37:32 +010040install: $(MOFILES) $(MOCONVERTED)
Bram Moolenaar58d98232005-07-23 22:25:46 +000041 @$(MAKE) prefixcheck
Bram Moolenaara4a29342018-06-24 15:52:56 +020042 for lang in $(LANGUAGES); do \
Bram Moolenaar071d4272004-06-13 20:20:40 +000043 dir=$(LOCALEDIR)/$$lang/; \
44 if test ! -x "$$dir"; then \
45 mkdir $$dir; chmod 755 $$dir; \
46 fi; \
47 dir=$(LOCALEDIR)/$$lang/LC_MESSAGES; \
48 if test ! -x "$$dir"; then \
49 mkdir $$dir; chmod 755 $$dir; \
50 fi; \
51 if test -r $$lang.mo; then \
52 $(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \
53 chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \
54 fi; \
55 done
56
57uninstall:
Bram Moolenaar58d98232005-07-23 22:25:46 +000058 @$(MAKE) prefixcheck
Bram Moolenaarc4fba6f2013-01-17 13:37:32 +010059 for cat in $(MOFILES) $(MOCONVERTED); do \
Bram Moolenaar071d4272004-06-13 20:20:40 +000060 cat=`basename $$cat`; \
61 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
62 rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
63 done
64
Bram Moolenaar0b39c3f2020-08-30 15:52:10 +020065# installing for local tryout into ../../runtime/lang
66tryoutinstall: $(MOFILES) $(MOCONVERTED)
67 @$(MAKE) prefixcheck
68 for lang in $(LANGUAGES); do \
69 dir=../../runtime/lang/$$lang/; \
70 if test ! -x "$$dir"; then \
71 mkdir $$dir; chmod 755 $$dir; \
72 fi; \
73 dir=../../runtime/lang/$$lang/LC_MESSAGES; \
74 if test ! -x "$$dir"; then \
75 mkdir $$dir; chmod 755 $$dir; \
76 fi; \
77 if test -r $$lang.mo; then \
78 cp $$lang.mo $$dir/$(PACKAGE).mo; \
79 chmod 644 $$dir/$(PACKAGE).mo; \
80 fi; \
81 done
82
Bram Moolenaarc4fba6f2013-01-17 13:37:32 +010083converted: $(MOCONVERTED)
Bram Moolenaar071d4272004-06-13 20:20:40 +000084
Bram Moolenaar02938a92013-05-04 03:37:10 +020085# nl.po was added later, if it does not exist use a file with just a # in it
86# (an empty file doesn't work with old msgfmt).
Bram Moolenaar8d616172013-01-30 12:50:56 +010087nl.po:
Bram Moolenaar02938a92013-05-04 03:37:10 +020088 @( echo \# > nl.po )
Bram Moolenaar8d616172013-01-30 12:50:56 +010089
Bram Moolenaar28c37952010-01-06 20:29:28 +010090# Norwegian/Bokmal: "nb" is an alias for "no".
91# Copying the file is not efficient, but I don't know of another way to make
92# this work.
93nb.po: no.po
94 cp no.po nb.po
95
Bram Moolenaar071d4272004-06-13 20:20:40 +000096# Convert ja.po to create ja.sjis.po. Requires doubling backslashes in the
97# second byte. Don't depend on sjiscorr, it should only be compiled when
98# ja.sjis.po is outdated.
99ja.sjis.po: ja.po
100 @$(MAKE) sjiscorr
101 rm -f ja.sjis.po
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200102 iconv -f utf-8 -t cp932 ja.po | ./sjiscorr > ja.sjis.po
Bram Moolenaar071d4272004-06-13 20:20:40 +0000103
104sjiscorr: sjiscorr.c
105 $(CC) -o sjiscorr sjiscorr.c
106
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200107ja.euc-jp.po: ja.po
108 iconv -f utf-8 -t euc-jp ja.po | \
Bram Moolenaard1d037e2018-06-24 18:04:50 +0200109 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 +0200110
Bram Moolenaar071d4272004-06-13 20:20:40 +0000111# Convert cs.po to create cs.cp1250.po.
112cs.cp1250.po: cs.po
113 rm -f cs.cp1250.po
114 iconv -f iso-8859-2 -t cp1250 cs.po | \
115 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' > cs.cp1250.po
116
117# Convert pl.po to create pl.cp1250.po.
118pl.cp1250.po: pl.po
119 rm -f pl.cp1250.po
120 iconv -f iso-8859-2 -t cp1250 pl.po | \
121 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.cp1250.po
122
Bram Moolenaar910f66f2006-04-05 20:41:53 +0000123# Convert pl.po to create pl.UTF-8.po.
124pl.UTF-8.po: pl.po
125 rm -f pl.UTF-8.po
126 iconv -f iso-8859-2 -t utf-8 pl.po | \
Bram Moolenaard1d037e2018-06-24 18:04:50 +0200127 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 +0000128
Bram Moolenaar071d4272004-06-13 20:20:40 +0000129# Convert sk.po to create sk.cp1250.po.
130sk.cp1250.po: sk.po
131 rm -f sk.cp1250.po
132 iconv -f iso-8859-2 -t cp1250 sk.po | \
133 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' > sk.cp1250.po
134
Bram Moolenaar16038d52017-01-27 20:37:49 +0100135# Convert zh_CN.UTF-8.po to create zh_CN.cp936.po.
136# Set 'charset' to gbk to avoid that msfmt generates a warning.
137# This used to convert from zh_CN.po, but that results in a conversion error.
138zh_CN.cp936.po: zh_CN.UTF-8.po
Bram Moolenaar071d4272004-06-13 20:20:40 +0000139 rm -f zh_CN.cp936.po
Bram Moolenaar16038d52017-01-27 20:37:49 +0100140 iconv -f UTF-8 -t cp936 zh_CN.UTF-8.po | \
Bram Moolenaard1d037e2018-06-24 18:04:50 +0200141 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 +0000142
Bram Moolenaar5e3dae82010-03-02 16:19:40 +0100143# Convert ko.UTF-8.po to create ko.po.
144ko.po: ko.UTF-8.po
145 rm -f ko.po
146 iconv -f UTF-8 -t euc-kr ko.UTF-8.po | \
147 sed -e 's/charset=UTF-8/charset=euc-kr/' \
148 -e 's/# Korean translation for Vim/# Generated from ko.UTF-8.po, DO NOT EDIT/' \
149 > ko.po
150
Bram Moolenaar071d4272004-06-13 20:20:40 +0000151# Convert ru.po to create ru.cp1251.po.
152ru.cp1251.po: ru.po
153 rm -f ru.cp1251.po
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000154 iconv -f utf-8 -t cp1251 ru.po | \
Bram Moolenaara4a29342018-06-24 15:52:56 +0200155 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 +0000156
Bram Moolenaar15d0a8c2004-09-06 17:44:46 +0000157# Convert uk.po to create uk.cp1251.po.
158uk.cp1251.po: uk.po
159 rm -f uk.cp1251.po
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000160 iconv -f utf-8 -t cp1251 uk.po | \
Bram Moolenaara4a29342018-06-24 15:52:56 +0200161 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 +0000162
Bram Moolenaar58d98232005-07-23 22:25:46 +0000163prefixcheck:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000164 @if test "x" = "x$(prefix)"; then \
165 echo "******************************************"; \
166 echo " please use make from the src directory "; \
167 echo "******************************************"; \
168 exit 1; \
169 fi
170
Bram Moolenaar316059c2006-01-14 21:18:42 +0000171clean: checkclean
172 rm -f core core.* *.old.po *.mo *.pot sjiscorr
Bram Moolenaard0380dc2019-06-05 21:25:34 +0200173 rm -f LINGUAS vim.desktop gvim.desktop tmp_*desktop
Bram Moolenaar071d4272004-06-13 20:20:40 +0000174
175distclean: clean
176
Bram Moolenaar316059c2006-01-14 21:18:42 +0000177checkclean:
178 rm -f *.ck
179
Bram Moolenaar0b39c3f2020-08-30 15:52:10 +0200180PO_INPUTLIST = \
181 ../*.c \
182 ../if_perl.xs \
183 ../GvimExt/gvimext.cpp \
184 ../globals.h \
185 ../if_py_both.h \
186 ../vim.h \
187 gvim.desktop.in \
188 vim.desktop.in
189
190PO_VIM_INPUTLIST = \
191 ../../runtime/optwin.vim
192
193PO_VIM_JSLIST = \
194 optwin.js
195
196$(PACKAGE).pot: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST)
197 # Convert the Vim scripts to (what looks like) Javascript
198 $(VIM) -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST)
199 # create vim.pot
200 $(XGETTEXT) --default-domain=$(PACKAGE) --add-comments \
201 --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 \
202 $(PO_INPUTLIST) $(PO_VIM_JSLIST)
203 mv -f $(PACKAGE).po $(PACKAGE).pot
204 # Fix Vim scripts names, so that "gf" works
205 $(VIM) -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST)
206 # Delete the temporary files
207 rm *.js
Bram Moolenaar071d4272004-06-13 20:20:40 +0000208
Bram Moolenaar12e91862019-05-03 21:20:03 +0200209vim.desktop: vim.desktop.in $(POFILES)
Bram Moolenaar403f3eb2019-11-20 22:31:13 +0100210 echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS
Bram Moolenaard0380dc2019-06-05 21:25:34 +0200211 $(MSGFMT) --desktop -d . --template vim.desktop.in -o tmp_vim.desktop
Bram Moolenaar91882cf2019-05-05 21:01:51 +0200212 rm -f LINGUAS
Bram Moolenaard0380dc2019-06-05 21:25:34 +0200213 if command -v desktop-file-validate; then desktop-file-validate tmp_vim.desktop; fi
214 mv tmp_vim.desktop vim.desktop
Bram Moolenaar12e91862019-05-03 21:20:03 +0200215
216gvim.desktop: gvim.desktop.in $(POFILES)
Bram Moolenaar403f3eb2019-11-20 22:31:13 +0100217 echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS
Bram Moolenaard0380dc2019-06-05 21:25:34 +0200218 $(MSGFMT) --desktop -d . --template gvim.desktop.in -o tmp_gvim.desktop
Bram Moolenaar91882cf2019-05-05 21:01:51 +0200219 rm -f LINGUAS
Bram Moolenaard0380dc2019-06-05 21:25:34 +0200220 if command -v desktop-file-validate; then desktop-file-validate tmp_gvim.desktop; fi
221 mv tmp_gvim.desktop gvim.desktop
Bram Moolenaara60e5362019-04-11 13:11:39 +0200222
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000223update-po: $(LANGUAGES)
224
Bram Moolenaar071d4272004-06-13 20:20:40 +0000225# Don't add a dependency here, we only want to update the .po files manually
226$(LANGUAGES):
227 @$(MAKE) $(PACKAGE).pot
228 if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi
229 mv $@.po $@.po.old
230 if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \
231 rm -f $@.po.old; \
232 else \
233 echo "msgmerge for $@.po failed!"; mv $@.po.old $@.po; \
234 fi