]> git.decadent.org.uk Git - ion3.git/blob - po/Makefile
23397381d2b27277af5936816afc511fe775e860
[ion3.git] / po / Makefile
1 ##
2 ## Ion po Makefile
3 ##
4
5 # System-specific configuration is in system.mk
6 TOPDIR=..
7 include $(TOPDIR)/build/system-inc.mk
8
9 XGETTEXT = xgettext
10 #MSGFMT = msgfmt -c
11 MSGFMT = msgfmt
12 MSGMERGE = msgmerge
13 MSGCAT = msgcat
14 LXGETTEXT = lua-xgettext
15
16 TRANSLATIONS := fi cs de ru
17 MO_FILES := $(patsubst %,%.mo, $(TRANSLATIONS))
18 PO_FILES := $(patsubst %,%.po, $(TRANSLATIONS))
19
20 POTDIRS=../ioncore \
21         ../mod_tiling \
22         ../mod_query \
23         ../mod_menu \
24         ../mod_sm \
25         ../mod_sp \
26         ../mod_statusbar \
27         ../mod_mgmtmode \
28         ../de \
29         ../ion \
30         ../pwm \
31         ../etc \
32         $(LIBEXTL_DIR)
33
34 EXTRA_POTFILES_LUA=../build/mkman.lua
35
36 POTFILE=ion3.pot
37
38 TARGETS = $(MO_FILES)
39
40 ifndef LOCALEDIR
41 LOCALEDIR := $(PREFIX)/share/locale
42 endif
43
44 ######################################
45
46 include $(TOPDIR)/build/rules.mk
47
48 ######################################
49
50 potfiles: potdirs_potfiles
51         (for i in $(POTDIRS); do cat $$i/potfiles_c|sed "s:\w\+:$$i/&:"; done) > potfiles_c
52         (for i in $(POTDIRS); do cat $$i/potfiles_lua|sed "s:\w\+:$$i/&:"; done; \
53          for i in $(EXTRA_POTFILES_LUA); do echo $$i; done) > potfiles_lua
54
55 potdirs_potfiles:
56         for i in $(POTDIRS); do make -C $$i _potfiles; done
57
58 pot: $(POTFILE)
59
60 $(POTFILE)_c: potfiles
61         $(XGETTEXT) -kTR -kDUMMY_TR -o $@ -f potfiles_c
62
63 $(POTFILE)_lua: potfiles
64         $(LXGETTEXT) -k TR -k bdoc -k submenu -k menuentry -o $@ \
65                 `cat potfiles_lua`
66
67 $(POTFILE): $(POTFILE)_c $(POTFILE)_lua
68         #
69         # GNU gettext sucks bigtime, and refuses to work on POT
70         # files without encoding set. Therefore we'll just have to
71         # use plain old cat and hope that there aren't dupes.
72         #
73         #msgcat -o $@ $+
74         #
75         cat $+ > $@
76
77 %.mo: %.po
78         $(MSGFMT) -o $@ $<
79
80 _install:
81         for i in $(TRANSLATIONS); do \
82                 $(INSTALLDIR) $(LOCALEDIR)/$$i/LC_MESSAGES ; \
83                 $(INSTALL) -m $(DATA_MODE) $$i.mo $(LOCALEDIR)/$$i/LC_MESSAGES/ion3.mo ; \
84         done
85
86 update_fi: pot
87         $(MSGMERGE) -U fi.po $(POTFILE)
88
89 update_cs: pot
90         $(MSGMERGE) -U cs.po $(POTFILE)
91
92 update_ru: pot
93         $(MSGMERGE) -U ru.po $(POTFILE)
94
95 update_de: pot
96         $(MSGMERGE) -U de.po $(POTFILE)