1# Makefile for the Vim message translations. 2 3# Include stuff found by configure. 4include ../auto/config.mk 5 6# get LANGUAGES, MOFILES, MOCONVERTED and CHECKFILES 7include Make_all.mak 8 9# Note: ja.sjis, *.cp1250 and zh_CN.cp936 are only for MS-Windows, they are 10# not installed on Unix 11 12PACKAGE = vim 13SHELL = /bin/sh 14VIM = ../vim 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! 20MSGFMTCMD = 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 .ck 26.PHONY: all install uninstall prefixcheck converted check clean checkclean distclean update-po $(LANGUAGES) 27 28.po.mo: 29 $(MSGFMTCMD) -o $@ $< 30 31.po.ck: 32 $(VIM) -u NONE -e -X -S check.vim -c "if error == 0 | q | endif" -c cq $< 33 touch $@ 34 35all: $(MOFILES) $(MOCONVERTED) $(MSGFMT_DESKTOP) 36 37check: $(CHECKFILES) 38 39# installing for real 40install: $(MOFILES) $(MOCONVERTED) 41 @$(MAKE) prefixcheck 42 for lang in $(LANGUAGES); do \ 43 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: 58 @$(MAKE) prefixcheck 59 for cat in $(MOFILES) $(MOCONVERTED); do \ 60 cat=`basename $$cat`; \ 61 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ 62 rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \ 63 done 64 65# 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 83converted: $(MOCONVERTED) 84 85# 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). 87nl.po: 88 @( echo \# > nl.po ) 89 90# 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 96# 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 102 iconv -f utf-8 -t cp932 ja.po | ./sjiscorr > ja.sjis.po 103 104sjiscorr: sjiscorr.c 105 $(CC) -o sjiscorr sjiscorr.c 106 107ja.euc-jp.po: ja.po 108 iconv -f utf-8 -t euc-jp ja.po | \ 109 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 110 111# 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 123# 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 | \ 127 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 128 129# 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 135# 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 139 rm -f zh_CN.cp936.po 140 iconv -f UTF-8 -t cp936 zh_CN.UTF-8.po | \ 141 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 142 143# 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 151# Convert ru.po to create ru.cp1251.po. 152ru.cp1251.po: ru.po 153 rm -f ru.cp1251.po 154 iconv -f utf-8 -t cp1251 ru.po | \ 155 sed -e 's/charset=[uU][tT][fF]-8/charset=cp1251/' -e 's/# Original translations/# Generated from ru.po, DO NOT EDIT/' > ru.cp1251.po 156 157# Convert uk.po to create uk.cp1251.po. 158uk.cp1251.po: uk.po 159 rm -f uk.cp1251.po 160 iconv -f utf-8 -t cp1251 uk.po | \ 161 sed -e 's/charset=[uU][tT][fF]-8/charset=cp1251/' -e 's/# Original translations/# Generated from uk.po, DO NOT EDIT/' > uk.cp1251.po 162 163prefixcheck: 164 @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 171clean: checkclean 172 rm -f core core.* *.old.po *.mo *.pot sjiscorr 173 rm -f LINGUAS vim.desktop gvim.desktop tmp_*desktop 174 175distclean: clean 176 177checkclean: 178 rm -f *.ck 179 180PO_INPUTLIST = \ 181 ../*.c \ 182 ../if_perl.xs \ 183 ../GvimExt/gvimext.cpp \ 184 ../errors.h \ 185 ../globals.h \ 186 ../if_py_both.h \ 187 ../vim.h \ 188 gvim.desktop.in \ 189 vim.desktop.in 190 191PO_VIM_INPUTLIST = \ 192 ../../runtime/optwin.vim 193 194PO_VIM_JSLIST = \ 195 optwin.js 196 197$(PACKAGE).pot: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST) 198 # Convert the Vim scripts to (what looks like) Javascript 199 $(VIM) -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST) 200 # create vim.pot 201 $(XGETTEXT) --default-domain=$(PACKAGE) --add-comments \ 202 --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 \ 203 $(PO_INPUTLIST) $(PO_VIM_JSLIST) 204 mv -f $(PACKAGE).po $(PACKAGE).pot 205 # Fix Vim scripts names, so that "gf" works 206 $(VIM) -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST) 207 # Delete the temporary files 208 rm *.js 209 210vim.desktop: vim.desktop.in $(POFILES) 211 echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS 212 $(MSGFMT) --desktop -d . --template vim.desktop.in -o tmp_vim.desktop 213 rm -f LINGUAS 214 if command -v desktop-file-validate; then desktop-file-validate tmp_vim.desktop; fi 215 mv tmp_vim.desktop vim.desktop 216 217gvim.desktop: gvim.desktop.in $(POFILES) 218 echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS 219 $(MSGFMT) --desktop -d . --template gvim.desktop.in -o tmp_gvim.desktop 220 rm -f LINGUAS 221 if command -v desktop-file-validate; then desktop-file-validate tmp_gvim.desktop; fi 222 mv tmp_gvim.desktop gvim.desktop 223 224update-po: $(LANGUAGES) 225 226# Don't add a dependency here, we only want to update the .po files manually 227$(LANGUAGES): 228 @$(MAKE) $(PACKAGE).pot 229 if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi 230 mv $@.po $@.po.old 231 if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \ 232 rm -f $@.po.old; \ 233 else \ 234 echo "msgmerge for $@.po failed!"; mv $@.po.old $@.po; \ 235 fi 236