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 39install: $(MOFILES) $(MOCONVERTED) 40 @$(MAKE) prefixcheck 41 for lang in $(LANGUAGES); do \ 42 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: 57 @$(MAKE) prefixcheck 58 for cat in $(MOFILES) $(MOCONVERTED); do \ 59 cat=`basename $$cat`; \ 60 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ 61 rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \ 62 done 63 64converted: $(MOCONVERTED) 65 66# 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). 68nl.po: 69 @( echo \# > nl.po ) 70 71# 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 77# 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 83 iconv -f utf-8 -t cp932 ja.po | ./sjiscorr > ja.sjis.po 84 85sjiscorr: sjiscorr.c 86 $(CC) -o sjiscorr sjiscorr.c 87 88ja.euc-jp.po: ja.po 89 iconv -f utf-8 -t euc-jp ja.po | \ 90 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 91 92# 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 104# 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 110# 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 116# 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 120 rm -f zh_CN.cp936.po 121 iconv -f UTF-8 -t cp936 zh_CN.UTF-8.po | \ 122 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 123 124# 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 132# Convert ru.po to create ru.cp1251.po. 133ru.cp1251.po: ru.po 134 rm -f ru.cp1251.po 135 iconv -f utf-8 -t cp1251 ru.po | \ 136 sed -e 's/charset=[uU][tT][fF]-8/charset=cp1251/' -e 's/# Original translations/# Generated from ru.po, DO NOT EDIT/' > ru.cp1251.po 137 138# Convert uk.po to create uk.cp1251.po. 139uk.cp1251.po: uk.po 140 rm -f uk.cp1251.po 141 iconv -f utf-8 -t cp1251 uk.po | \ 142 sed -e 's/charset=[uU][tT][fF]-8/charset=cp1251/' -e 's/# Original translations/# Generated from uk.po, DO NOT EDIT/' > uk.cp1251.po 143 144prefixcheck: 145 @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 152clean: checkclean 153 rm -f core core.* *.old.po *.mo *.pot sjiscorr 154 rm -f LINGUAS vim.desktop gvim.desktop tmp_*desktop 155 156distclean: clean 157 158checkclean: 159 rm -f *.ck 160 161$(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h ../if_py_both.h ../vim.h gvim.desktop.in vim.desktop.in 162 cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \ 163 --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 \ 164 *.c if_perl.xs GvimExt/gvimext.cpp globals.h if_py_both.h vim.h \ 165 po/gvim.desktop.in po/vim.desktop.in 166 mv -f ../$(PACKAGE).po $(PACKAGE).pot 167 168vim.desktop: vim.desktop.in $(POFILES) 169 echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS 170 $(MSGFMT) --desktop -d . --template vim.desktop.in -o tmp_vim.desktop 171 rm -f LINGUAS 172 if command -v desktop-file-validate; then desktop-file-validate tmp_vim.desktop; fi 173 mv tmp_vim.desktop vim.desktop 174 175gvim.desktop: gvim.desktop.in $(POFILES) 176 echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS 177 $(MSGFMT) --desktop -d . --template gvim.desktop.in -o tmp_gvim.desktop 178 rm -f LINGUAS 179 if command -v desktop-file-validate; then desktop-file-validate tmp_gvim.desktop; fi 180 mv tmp_gvim.desktop gvim.desktop 181 182update-po: $(LANGUAGES) 183 184# Don't add a dependency here, we only want to update the .po files manually 185$(LANGUAGES): 186 @$(MAKE) $(PACKAGE).pot 187 if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi 188 mv $@.po $@.po.old 189 if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \ 190 rm -f $@.po.old; \ 191 else \ 192 echo "msgmerge for [email protected] failed!"; mv $@.po.old $@.po; \ 193 fi 194