summaryrefslogtreecommitdiff
blob: 7a07f4d44eff8e5db07943c0a410ecaa7d1240a3 (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
initd_IN  := $(wildcard ../init.d/*)
sbin_IN   := $(filter-out %.patch,$(wildcard ../sbin/*))
ALL_IN    := $(initd_IN) $(sbin_IN)

localedir   := $(shell eval `grep '^svclib' ../sbin/functions.sh`; echo "$${svclib}/locale")
LINGUAS_ALL := $(patsubst %.po,%,$(wildcard *.po))
LINGUAS     ?= $(LINGUAS_ALL)
LINGUAS     := $(filter $(LINGUAS_ALL),$(LINGUAS))

all: $(LINGUAS:%=%.mo)

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

%.po : rc-scripts.pot
	msgmerge --update $@ $^

rc-scripts.pot: $(ALL_IN)
	rm -f rc-scripts.pot; touch rc-scripts.pot
	for file in $+ ; do \
	       bash --dump-po-strings $$file \
	       | msguniq \
	       | msgcat --force-po -F - rc-scripts.pot -o rc-scripts.pot; \
	done

clean:
	rm -f *.mo *~

install: all
	for lang in $(LINGUAS); do \
		install -d $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES ; \
		install -m 644 $$lang.mo \
			$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/rc-scripts.mo ; \
	done

.PHONY: install clean all