blob: 5e9428f6474f91ee56fb0f21e27114d6ec5ed920 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001# Makefile for the Vim message translations for mingw32
2#
3# Eduardo F. Amatria <eferna1@platea.pntic.mec.es>
4#
5# Read the README_ming.txt file before using it.
6#
7# Use at your own risk but with care, it could even kill your canary.
8#
9# Previous to all you must have the environment variable LANGUAGE set to your
10# language (xx) and add it to the next three lines.
11#
12
Bram Moolenaar01380622015-12-29 16:04:42 +010013ifndef VIMRUNTIME
Bram Moolenaar8889a5c2017-11-02 19:27:36 +010014ifeq (sh.exe, $(SHELL))
Bram Moolenaar01380622015-12-29 16:04:42 +010015VIMRUNTIME = ..\..\runtime
Bram Moolenaar8889a5c2017-11-02 19:27:36 +010016else
17VIMRUNTIME = ../../runtime
18endif
Bram Moolenaar01380622015-12-29 16:04:42 +010019endif
20
Bram Moolenaara4a29342018-06-24 15:52:56 +020021# get LANGUAGES, MOFILES and MOCONVERTED
22include Make_all.mak
Bram Moolenaar071d4272004-06-13 20:20:40 +000023
24PACKAGE = vim
Bram Moolenaarfa573352020-09-04 13:53:00 +020025ifeq (sh.exe, $(SHELL))
26VIM = ..\vim
27else
28VIM = ../vim
29endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000030
31# Uncomment one of the lines below or modify it to put the path to your
32# gettex binaries; I use the first
33#GETTEXT_PATH = C:/gettext.win32/bin/
34#GETTEXT_PATH = C:/gettext-0.10.35-w32/win32/Release/
35#GETTEXT_PATH = C:/cygwin/bin/
36
Bram Moolenaar8889a5c2017-11-02 19:27:36 +010037ifeq (sh.exe, $(SHELL))
Bram Moolenaar01380622015-12-29 16:04:42 +010038MSGFMT = set OLD_PO_FILE_INPUT=yes && $(GETTEXT_PATH)msgfmt -v
39XGETTEXT = set OLD_PO_FILE_INPUT=yes && set OLD_PO_FILE_OUTPUT=yes && $(GETTEXT_PATH)xgettext
40MSGMERGE = set OLD_PO_FILE_INPUT=yes && set OLD_PO_FILE_OUTPUT=yes && $(GETTEXT_PATH)msgmerge
Bram Moolenaar8889a5c2017-11-02 19:27:36 +010041else
42MSGFMT = LANG=C OLD_PO_FILE_INPUT=yes $(GETTEXT_PATH)msgfmt -v
43XGETTEXT = LANG=C OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes $(GETTEXT_PATH)xgettext
44MSGMERGE = LANG=C OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes $(GETTEXT_PATH)msgmerge
45endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000046
Bram Moolenaar8889a5c2017-11-02 19:27:36 +010047ifeq (sh.exe, $(SHELL))
Bram Moolenaar071d4272004-06-13 20:20:40 +000048MV = move
49CP = copy
50RM = del
51MKD = mkdir
Bram Moolenaar8889a5c2017-11-02 19:27:36 +010052else
53MV = mv -f
54CP = cp -f
55RM = rm -f
56MKD = mkdir -p
57endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000058
59.SUFFIXES:
60.SUFFIXES: .po .mo .pot
Bram Moolenaarfa573352020-09-04 13:53:00 +020061.PHONY: first_time all install install-all clean $(LANGUAGES)
Bram Moolenaar071d4272004-06-13 20:20:40 +000062
63.po.mo:
64 $(MSGFMT) -o $@ $<
65
Bram Moolenaara4a29342018-06-24 15:52:56 +020066all: $(MOFILES) $(MOCONVERTED)
Bram Moolenaar071d4272004-06-13 20:20:40 +000067
Bram Moolenaarfa573352020-09-04 13:53:00 +020068PO_INPUTLIST = \
69 $(wildcard ../*.c) \
70 ../if_perl.xs \
71 ../GvimExt/gvimext.cpp \
72 ../errors.h \
73 ../globals.h \
74 ../if_py_both.h \
75 ../vim.h \
76 gvim.desktop.in \
77 vim.desktop.in
Bram Moolenaar071d4272004-06-13 20:20:40 +000078
Bram Moolenaarfa573352020-09-04 13:53:00 +020079PO_VIM_INPUTLIST = \
80 ../../runtime/optwin.vim
81
82PO_VIM_JSLIST = \
83 optwin.js
84
85first_time: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST)
86 $(VIM) -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).pot $(PO_VIM_INPUTLIST)
87 $(XGETTEXT) --default-domain=$(LANGUAGE) \
88 --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 $(PO_INPUTLIST) $(PO_VIM_JSLIST)
89 $(VIM) -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).pot $(PO_VIM_INPUTLIST)
90 $(RM) *.js
91
92$(PACKAGE).pot: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST)
93 $(VIM) -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST)
Bram Moolenaar071d4272004-06-13 20:20:40 +000094 $(XGETTEXT) --default-domain=$(PACKAGE) \
Bram Moolenaarfa573352020-09-04 13:53:00 +020095 --add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 $(PO_INPUTLIST) $(PO_VIM_JSLIST)
Bram Moolenaar071d4272004-06-13 20:20:40 +000096 $(MV) $(PACKAGE).po $(PACKAGE).pot
Bram Moolenaarfa573352020-09-04 13:53:00 +020097 $(VIM) -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST)
98 $(RM) *.js
99
100# Don't add a dependency here, we only want to update the .po files manually
101$(LANGUAGES):
102 @$(MAKE) -f Make_ming.mak $(PACKAGE).pot GETTEXT_PATH=$(GETTEXT_PATH)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000103 $(CP) $@.po $@.po.orig
104 $(MV) $@.po $@.po.old
105 $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po
106 $(RM) $@.po.old
107
108install:
109 $(MKD) $(VIMRUNTIME)\lang\$(LANGUAGE)
110 $(MKD) $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES
111 $(CP) $(LANGUAGE).mo $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES\$(PACKAGE).mo
112
Bram Moolenaar8889a5c2017-11-02 19:27:36 +0100113ifeq (sh.exe, $(SHELL))
Bram Moolenaar01380622015-12-29 16:04:42 +0100114install-all: all
115 FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(VIMRUNTIME)\lang\%%l $(MKD) $(VIMRUNTIME)\lang\%%l
116 FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(VIMRUNTIME)\lang\%%l\LC_MESSAGES $(MKD) $(VIMRUNTIME)\lang\%%l\LC_MESSAGES
117 FOR %%l IN ($(LANGUAGES)) DO @$(CP) %%l.mo $(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo
Bram Moolenaar8889a5c2017-11-02 19:27:36 +0100118else
119install-all: all
120 for TARGET in $(LANGUAGES); do \
121 $(MKD) $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES ; \
122 $(CP) $$TARGET.mo $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES/$(PACKAGE).mo ; \
123 done
124endif
Bram Moolenaar01380622015-12-29 16:04:42 +0100125
Bram Moolenaar071d4272004-06-13 20:20:40 +0000126clean:
127 $(RM) *.mo
128 $(RM) *.pot