summaryrefslogtreecommitdiff
path: root/po/Makefile
blob: dd8e46e9c3265287d5c8280670b0a28e1d21a155 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Makefile to manage gettext files

DOMAIN=live-helper
ECHO_FUNCTIONS="Echo_message Echo_verbose Echo_warning Echo_debug Echo_error"

POFILES=$(wildcard *.po)
MOFILES=$(patsubst %.po,%.mo,$(POFILES))
LINGUAS=$(basename $(POFILES))
GETTEXTFILES=$(shell find ../helpers -type f)
POTFILE=$(DOMAIN).pot
DESTDIR=/
XGETTEXT_KEYWORDS=$(shell echo $(ECHO_FUNCTIONS) |sed -e 's,\S\+,-k&,g')

%.mo: %.po
	msgfmt --statistics -o $@ $<

%.po: $(DOMAIN).pot
	msgmerge -U $*.po $(DOMAIN).pot

$(DOMAIN).pot: $(GETTEXTFILES)
	$(shell xgettext $(XGETTEXT_KEYWORDS) -L Shell -o $(DOMAIN).pot $(GETTEXTFILES))

update-po:
	-for lang in $(LINGUAS); do\
	    msgmerge -U $$lang.po $(DOMAIN).pot; \
	done

install: $(MOFILES)
	-for lang in $(LINGUAS); do\
	    install -d $(DESTDIR)/usr/share/locale/$$lang/LC_MESSAGES/; \
	    install -m 644 $$lang.mo $(DESTDIR)/usr/share/locale/$$lang/LC_MESSAGES/$(DOMAIN).mo; \
	done

all: update-po $(MOFILES)

clean:
	- rm *.mo *~

.PHONY: update-po