blob: 21d2d2037cdc8190d99f1eb74c558a5e4c570a13 [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 Moolenaar167fb6d2023-05-23 15:27:51 +010021# get LANGUAGES, MOFILES, MOCONVERTED and others
Bram Moolenaara4a29342018-06-24 15:52:56 +020022include Make_all.mak
Bram Moolenaar071d4272004-06-13 20:20:40 +000023
24PACKAGE = vim
Bram Moolenaarfa573352020-09-04 13:53:00 +020025ifeq (sh.exe, $(SHELL))
RestorerZcd33faf2024-07-04 17:47:16 +020026VIMPROG = ..\vim
Bram Moolenaarfa573352020-09-04 13:53:00 +020027else
RestorerZcd33faf2024-07-04 17:47:16 +020028VIMPROG = ../vim
Bram Moolenaarfa573352020-09-04 13:53:00 +020029endif
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 +020079first_time: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST)
RestorerZcd33faf2024-07-04 17:47:16 +020080 $(VIMPROG) -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).pot $(PO_VIM_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +020081 $(XGETTEXT) --default-domain=$(LANGUAGE) \
Bram Moolenaara1d5f9f2023-05-27 13:40:11 +010082 --add-comments $(XGETTEXT_KEYWORDS) $(PO_INPUTLIST) $(PO_VIM_JSLIST)
RestorerZcd33faf2024-07-04 17:47:16 +020083 $(VIMPROG) -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).pot $(PO_VIM_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +020084 $(RM) *.js
85
86$(PACKAGE).pot: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST)
RestorerZcd33faf2024-07-04 17:47:16 +020087 $(VIMPROG) -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST)
Bram Moolenaar071d4272004-06-13 20:20:40 +000088 $(XGETTEXT) --default-domain=$(PACKAGE) \
Bram Moolenaara1d5f9f2023-05-27 13:40:11 +010089 --add-comments $(XGETTEXT_KEYWORDS) $(PO_INPUTLIST) $(PO_VIM_JSLIST)
Bram Moolenaar071d4272004-06-13 20:20:40 +000090 $(MV) $(PACKAGE).po $(PACKAGE).pot
RestorerZcd33faf2024-07-04 17:47:16 +020091 $(VIMPROG) -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST)
Bram Moolenaarfa573352020-09-04 13:53:00 +020092 $(RM) *.js
93
94# Don't add a dependency here, we only want to update the .po files manually
95$(LANGUAGES):
96 @$(MAKE) -f Make_ming.mak $(PACKAGE).pot GETTEXT_PATH=$(GETTEXT_PATH)
Bram Moolenaar071d4272004-06-13 20:20:40 +000097 $(CP) $@.po $@.po.orig
98 $(MV) $@.po $@.po.old
99 $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po
100 $(RM) $@.po.old
101
102install:
103 $(MKD) $(VIMRUNTIME)\lang\$(LANGUAGE)
104 $(MKD) $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES
105 $(CP) $(LANGUAGE).mo $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES\$(PACKAGE).mo
106
Bram Moolenaar8889a5c2017-11-02 19:27:36 +0100107ifeq (sh.exe, $(SHELL))
Bram Moolenaar01380622015-12-29 16:04:42 +0100108install-all: all
109 FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(VIMRUNTIME)\lang\%%l $(MKD) $(VIMRUNTIME)\lang\%%l
110 FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(VIMRUNTIME)\lang\%%l\LC_MESSAGES $(MKD) $(VIMRUNTIME)\lang\%%l\LC_MESSAGES
111 FOR %%l IN ($(LANGUAGES)) DO @$(CP) %%l.mo $(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo
Bram Moolenaar8889a5c2017-11-02 19:27:36 +0100112else
113install-all: all
114 for TARGET in $(LANGUAGES); do \
115 $(MKD) $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES ; \
116 $(CP) $$TARGET.mo $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES/$(PACKAGE).mo ; \
117 done
118endif
Bram Moolenaar01380622015-12-29 16:04:42 +0100119
Bram Moolenaar071d4272004-06-13 20:20:40 +0000120clean:
121 $(RM) *.mo
122 $(RM) *.pot