blob: 57aa375bc83b7987c98ba00dce50c2486b7965c4 [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 Moolenaarc4fba6f2013-01-17 13:37:32 +010035all: $(MOFILES) $(MOCONVERTED)
Bram Moolenaar071d4272004-06-13 20:20:40 +000036
Bram Moolenaar58d98232005-07-23 22:25:46 +000037check: $(CHECKFILES)
38
Bram Moolenaarc4fba6f2013-01-17 13:37:32 +010039install: $(MOFILES) $(MOCONVERTED)
Bram Moolenaar58d98232005-07-23 22:25:46 +000040 @$(MAKE) prefixcheck
Bram Moolenaara4a29342018-06-24 15:52:56 +020041 for lang in $(LANGUAGES); do \
Bram Moolenaar071d4272004-06-13 20:20:40 +000042 dir=$(LOCALEDIR)/$$lang/; \
43 if test ! -x "$$dir"; then \
44 mkdir $$dir; chmod 755 $$dir; \
45 fi; \
46 dir=$(LOCALEDIR)/$$lang/LC_MESSAGES; \
47 if test ! -x "$$dir"; then \
48 mkdir $$dir; chmod 755 $$dir; \
49 fi; \
50 if test -r $$lang.mo; then \
51 $(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \
52 chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \
53 fi; \
54 done
55
56uninstall:
Bram Moolenaar58d98232005-07-23 22:25:46 +000057 @$(MAKE) prefixcheck
Bram Moolenaarc4fba6f2013-01-17 13:37:32 +010058 for cat in $(MOFILES) $(MOCONVERTED); do \
Bram Moolenaar071d4272004-06-13 20:20:40 +000059 cat=`basename $$cat`; \
60 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
61 rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
62 done
63
Bram Moolenaarc4fba6f2013-01-17 13:37:32 +010064converted: $(MOCONVERTED)
Bram Moolenaar071d4272004-06-13 20:20:40 +000065
Bram Moolenaar02938a92013-05-04 03:37:10 +020066# nl.po was added later, if it does not exist use a file with just a # in it
67# (an empty file doesn't work with old msgfmt).
Bram Moolenaar8d616172013-01-30 12:50:56 +010068nl.po:
Bram Moolenaar02938a92013-05-04 03:37:10 +020069 @( echo \# > nl.po )
Bram Moolenaar8d616172013-01-30 12:50:56 +010070
Bram Moolenaar28c37952010-01-06 20:29:28 +010071# Norwegian/Bokmal: "nb" is an alias for "no".
72# Copying the file is not efficient, but I don't know of another way to make
73# this work.
74nb.po: no.po
75 cp no.po nb.po
76
Bram Moolenaar071d4272004-06-13 20:20:40 +000077# Convert ja.po to create ja.sjis.po. Requires doubling backslashes in the
78# second byte. Don't depend on sjiscorr, it should only be compiled when
79# ja.sjis.po is outdated.
80ja.sjis.po: ja.po
81 @$(MAKE) sjiscorr
82 rm -f ja.sjis.po
Bram Moolenaare6ae6222013-05-21 21:01:10 +020083 iconv -f utf-8 -t cp932 ja.po | ./sjiscorr > ja.sjis.po
Bram Moolenaar071d4272004-06-13 20:20:40 +000084
85sjiscorr: sjiscorr.c
86 $(CC) -o sjiscorr sjiscorr.c
87
Bram Moolenaare6ae6222013-05-21 21:01:10 +020088ja.euc-jp.po: ja.po
89 iconv -f utf-8 -t euc-jp ja.po | \
90 sed -e 's/charset=utf-8/charset=euc-jp/' -e 's/# Original translations/# Generated from ja.po, DO NOT EDIT/' > ja.euc-jp.po
91
Bram Moolenaar071d4272004-06-13 20:20:40 +000092# Convert cs.po to create cs.cp1250.po.
93cs.cp1250.po: cs.po
94 rm -f cs.cp1250.po
95 iconv -f iso-8859-2 -t cp1250 cs.po | \
96 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' > cs.cp1250.po
97
98# Convert pl.po to create pl.cp1250.po.
99pl.cp1250.po: pl.po
100 rm -f pl.cp1250.po
101 iconv -f iso-8859-2 -t cp1250 pl.po | \
102 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.cp1250.po
103
Bram Moolenaar910f66f2006-04-05 20:41:53 +0000104# Convert pl.po to create pl.UTF-8.po.
105pl.UTF-8.po: pl.po
106 rm -f pl.UTF-8.po
107 iconv -f iso-8859-2 -t utf-8 pl.po | \
108 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
109
Bram Moolenaar071d4272004-06-13 20:20:40 +0000110# Convert sk.po to create sk.cp1250.po.
111sk.cp1250.po: sk.po
112 rm -f sk.cp1250.po
113 iconv -f iso-8859-2 -t cp1250 sk.po | \
114 sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' > sk.cp1250.po
115
Bram Moolenaar16038d52017-01-27 20:37:49 +0100116# Convert zh_CN.UTF-8.po to create zh_CN.cp936.po.
117# Set 'charset' to gbk to avoid that msfmt generates a warning.
118# This used to convert from zh_CN.po, but that results in a conversion error.
119zh_CN.cp936.po: zh_CN.UTF-8.po
Bram Moolenaar071d4272004-06-13 20:20:40 +0000120 rm -f zh_CN.cp936.po
Bram Moolenaar16038d52017-01-27 20:37:49 +0100121 iconv -f UTF-8 -t cp936 zh_CN.UTF-8.po | \
Bram Moolenaar74675a62017-07-15 13:53:23 +0200122 sed -e 's/charset=utf-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 +0000123
Bram Moolenaar5e3dae82010-03-02 16:19:40 +0100124# Convert ko.UTF-8.po to create ko.po.
125ko.po: ko.UTF-8.po
126 rm -f ko.po
127 iconv -f UTF-8 -t euc-kr ko.UTF-8.po | \
128 sed -e 's/charset=UTF-8/charset=euc-kr/' \
129 -e 's/# Korean translation for Vim/# Generated from ko.UTF-8.po, DO NOT EDIT/' \
130 > ko.po
131
Bram Moolenaar071d4272004-06-13 20:20:40 +0000132# Convert ru.po to create ru.cp1251.po.
133ru.cp1251.po: ru.po
134 rm -f ru.cp1251.po
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000135 iconv -f utf-8 -t cp1251 ru.po | \
Bram Moolenaara4a29342018-06-24 15:52:56 +0200136 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 +0000137
Bram Moolenaar15d0a8c2004-09-06 17:44:46 +0000138# Convert uk.po to create uk.cp1251.po.
139uk.cp1251.po: uk.po
140 rm -f uk.cp1251.po
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000141 iconv -f utf-8 -t cp1251 uk.po | \
Bram Moolenaara4a29342018-06-24 15:52:56 +0200142 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 +0000143
Bram Moolenaar58d98232005-07-23 22:25:46 +0000144prefixcheck:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000145 @if test "x" = "x$(prefix)"; then \
146 echo "******************************************"; \
147 echo " please use make from the src directory "; \
148 echo "******************************************"; \
149 exit 1; \
150 fi
151
Bram Moolenaar316059c2006-01-14 21:18:42 +0000152clean: checkclean
153 rm -f core core.* *.old.po *.mo *.pot sjiscorr
Bram Moolenaar071d4272004-06-13 20:20:40 +0000154
155distclean: clean
156
Bram Moolenaar316059c2006-01-14 21:18:42 +0000157checkclean:
158 rm -f *.ck
159
Bram Moolenaarc36651b2018-04-29 12:22:56 +0200160$(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h ../if_py_both.h ../vim.h
Bram Moolenaar071d4272004-06-13 20:20:40 +0000161 cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \
Bram Moolenaar228de1d2018-03-14 20:11:12 +0100162 --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 \
Bram Moolenaarc36651b2018-04-29 12:22:56 +0200163 *.c if_perl.xs GvimExt/gvimext.cpp globals.h if_py_both.h vim.h
Bram Moolenaar071d4272004-06-13 20:20:40 +0000164 mv -f ../$(PACKAGE).po $(PACKAGE).pot
165
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000166update-po: $(LANGUAGES)
167
Bram Moolenaar071d4272004-06-13 20:20:40 +0000168# Don't add a dependency here, we only want to update the .po files manually
169$(LANGUAGES):
170 @$(MAKE) $(PACKAGE).pot
171 if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi
172 mv $@.po $@.po.old
173 if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \
174 rm -f $@.po.old; \
175 else \
176 echo "msgmerge for $@.po failed!"; mv $@.po.old $@.po; \
177 fi