xref: /vim-8.2.3635/src/po/Makefile (revision 7d1f5dbc)
1# Makefile for the Vim message translations.
2
3# TODO make this configurable
4# Note: ja.sjis, *.cp1250 and zh_CN.cp936 are only for MS-Windows, they are
5# not installed on Unix
6
7LANGUAGES =	af ca cs de en_GB es fr ga it ja ko no pl ru sk sv uk vi zh_TW \
8		zh_TW.UTF-8 zh_CN zh_CN.UTF-8
9MOFILES =	af.mo ca.mo cs.mo de.mo en_GB.mo es.mo fr.mo ga.mo it.mo ja.mo \
10		ko.mo no.mo pl.mo ru.mo sk.mo sv.mo uk.mo vi.mo \
11		zh_TW.mo zh_TW.UTF-8.mo zh_CN.mo zh_CN.UTF-8.mo
12
13PACKAGE = vim
14SHELL = /bin/sh
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!
20MSGFMT = 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
26.PHONY: all install uninstall check clean distclean $(LANGUAGES)
27
28.po.mo:
29	$(MSGFMT) -o $@ $<
30
31all: $(MOFILES)
32
33install: $(MOFILES)
34	@$(MAKE) check
35	for lang in $(LANGUAGES); do \
36	  dir=$(LOCALEDIR)/$$lang/; \
37	  if test ! -x "$$dir"; then \
38	    mkdir $$dir; chmod 755 $$dir; \
39	  fi; \
40	  dir=$(LOCALEDIR)/$$lang/LC_MESSAGES; \
41	  if test ! -x "$$dir"; then \
42	    mkdir $$dir; chmod 755 $$dir; \
43	  fi; \
44	  if test -r $$lang.mo; then \
45	    $(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \
46	    chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \
47	  fi; \
48	done
49
50uninstall:
51	@$(MAKE) check
52	for cat in $(MOFILES); do \
53	  cat=`basename $$cat`; \
54	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
55	  rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
56	done
57
58converted: ja.sjis.mo cs.cp1250.mo pl.cp1250.mo sk.cp1250.mo zh_CN.cp936.mo \
59		ru.cp1251.mo uk.cp1251.mo
60
61# Convert ja.po to create ja.sjis.po.  Requires doubling backslashes in the
62# second byte.  Don't depend on sjiscorr, it should only be compiled when
63# ja.sjis.po is outdated.
64ja.sjis.po: ja.po
65	@$(MAKE) sjiscorr
66	rm -f ja.sjis.po
67	iconv -f euc-jp -t cp932 ja.po | ./sjiscorr > ja.sjis.po
68
69sjiscorr: sjiscorr.c
70	$(CC) -o sjiscorr sjiscorr.c
71
72# Convert cs.po to create cs.cp1250.po.
73cs.cp1250.po: cs.po
74	rm -f cs.cp1250.po
75	iconv -f iso-8859-2 -t cp1250 cs.po | \
76		sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' > cs.cp1250.po
77
78# Convert pl.po to create pl.cp1250.po.
79pl.cp1250.po: pl.po
80	rm -f pl.cp1250.po
81	iconv -f iso-8859-2 -t cp1250 pl.po | \
82		sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.cp1250.po
83
84# Convert sk.po to create sk.cp1250.po.
85sk.cp1250.po: sk.po
86	rm -f sk.cp1250.po
87	iconv -f iso-8859-2 -t cp1250 sk.po | \
88		sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' > sk.cp1250.po
89
90# Convert zh_CN.po to create zh_CN.cp936.po.
91# set 'charset' to gbk to avoid that msfmt generates a warning
92zh_CN.cp936.po: zh_CN.po
93	rm -f zh_CN.cp936.po
94	iconv -f gb2312 -t cp936 zh_CN.po | \
95		sed -e 's/charset=gb2312/charset=gbk/' -e 's/# Original translations/# Generated from zh_CN.po, DO NOT EDIT/' > zh_CN.cp936.po
96
97# Convert ru.po to create ru.cp1251.po.
98ru.cp1251.po: ru.po
99	rm -f ru.cp1251.po
100	iconv -f utf-8 -t cp1251 ru.po | \
101		sed -e 's/charset=utf-8/charset=cp1251/' -e 's/# Original translations/# Generated from ru.po, DO NOT EDIT/' > ru.cp1251.po
102
103# Convert uk.po to create uk.cp1251.po.
104uk.cp1251.po: uk.po
105	rm -f uk.cp1251.po
106	iconv -f koi8-u -t cp1251 uk.po | \
107		sed -e 's/charset=koi8-u/charset=cp1251/' -e 's/# Original translations/# Generated from uk.po, DO NOT EDIT/' > uk.cp1251.po
108
109check:
110	@if test "x" = "x$(prefix)"; then \
111	  echo "******************************************"; \
112	  echo "  please use make from the src directory  "; \
113	  echo "******************************************"; \
114	  exit 1; \
115	fi
116
117clean:
118	rm -f core core.* *.old.po *.mo *.pot sjiscorr
119
120distclean: clean
121
122#
123# NOTE: If you get an error for gvimext.cpp not found, you need to unpack the
124# extra archive.
125#
126$(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h
127	cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \
128		--add-comments --keyword=_ --keyword=N_ \
129		*.c if_perl.xs GvimExt/gvimext.cpp globals.h
130	mv -f ../$(PACKAGE).po $(PACKAGE).pot
131
132# Don't add a dependency here, we only want to update the .po files manually
133$(LANGUAGES):
134	@$(MAKE) $(PACKAGE).pot
135	if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi
136	mv $@.po $@.po.old
137	if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \
138	    rm -f $@.po.old; \
139	else \
140	    echo "msgmerge for [email protected] failed!"; mv $@.po.old $@.po; \
141	fi
142