1# Makefile for the Vim message translations for Cygwin
2# by Tony Mechelynck <antoine.mechelynck@skynet.be>
3# after Make_ming.mak by
4# Eduardo F. Amatria <eferna1@platea.pntic.mec.es>
5#
6# Read the README_ming.txt file before using it.
7#
8# Use at your own risk but with care, it could even kill your canary.
9#
10
11ifndef VIMRUNTIME
12VIMRUNTIME = ../../runtime
13endif
14
15# get LANGUAGES, MOFILES and MOCONVERTED
16include Make_all.mak
17
18PACKAGE = vim
19VIM = ../vim
20
21# Uncomment one of the lines below or modify it to put the path to your
22# gettext binaries
23ifndef GETTEXT_PATH
24#GETTEXT_PATH = C:/gettext.win32/bin/
25#GETTEXT_PATH = C:/gettext-0.10.35-w32/win32/Release/
26GETTEXT_PATH = /bin/
27endif
28
29# The OLD_PO_FILE_INPUT and OLD_PO_FILE_OUTPUT are for the new GNU gettext
30# tools 0.10.37, which use a slightly different .po file format that is not
31# compatible with Solaris (and old gettext implementations) unless these are
32# set.  gettext 0.10.36 will not work!
33MSGFMT = OLD_PO_FILE_INPUT=yes $(GETTEXT_PATH)msgfmt -v
34XGETTEXT = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes $(GETTEXT_PATH)xgettext
35MSGMERGE = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes $(GETTEXT_PATH)msgmerge
36
37# MV = move
38# CP = copy
39# RM = del
40# MKD = mkdir
41MV = mv -f
42CP = cp -f
43RM = rm -f
44MKD = mkdir -p
45
46.SUFFIXES:
47.SUFFIXES: .po .mo .pot
48.PHONY: first_time all install install-all clean $(LANGUAGES)
49
50.po.mo:
51	$(MSGFMT) -o $@ $<
52
53all: $(MOFILES) $(MOCONVERTED)
54
55PO_INPUTLIST = \
56	$(wildcard ../*.c) \
57	../if_perl.xs \
58	../GvimExt/gvimext.cpp \
59	../errors.h \
60	../globals.h \
61	../if_py_both.h \
62	../vim.h \
63	gvim.desktop.in \
64	vim.desktop.in
65
66PO_VIM_INPUTLIST = \
67	../../runtime/optwin.vim
68
69PO_VIM_JSLIST = \
70	optwin.js
71
72first_time: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST)
73	$(VIM) -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).pot $(PO_VIM_INPUTLIST)
74	$(XGETTEXT) --default-domain=$(LANGUAGE) \
75		--add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 $(PO_INPUTLIST) $(PO_VIM_JSLIST)
76	$(VIM) -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).pot $(PO_VIM_INPUTLIST)
77	$(RM) *.js
78
79$(PACKAGE).pot: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST)
80	$(VIM) -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST)
81	$(XGETTEXT) --default-domain=$(PACKAGE) \
82		--add-comments --keyword=_ --keyword=N_ --keyword=NGETTEXT:1,2 $(PO_INPUTLIST) $(PO_VIM_JSLIST)
83	$(MV) $(PACKAGE).po $(PACKAGE).pot
84	$(VIM) -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST)
85	$(RM) *.js
86
87# Don't add a dependency here, we only want to update the .po files manually
88$(LANGUAGES):
89	@$(MAKE) -f Make_cyg.mak $(PACKAGE).pot GETTEXT_PATH=$(GETTEXT_PATH)
90	$(CP) $@.po $@.po.orig
91	$(MV) $@.po $@.po.old
92	$(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po
93	$(RM) $@.po.old
94
95install: $(MOFILES) $(MOCONVERTED)
96	for TARGET in $(LANGUAGES); do \
97		$(MKD) $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES ; \
98		$(CP) $$TARGET.mo $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES/$(PACKAGE).mo ; \
99	done
100
101install-all: install
102
103clean:
104	$(RM) *.mo
105	$(RM) *.pot
106