-
Notifications
You must be signed in to change notification settings - Fork 36
/
Makefile
65 lines (47 loc) · 1.7 KB
/
Makefile
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
VERSION = 1.4.0
LINGUAS = $(shell awk '$$1=="[po4a_langs]"{$$1="";print}' po4a.conf)
PREFIX ?=
.PHONY: all-mo
all-mo: $(LINGUAS:%=po/%.mo)
.PHONY: all
all: all-mo all-manpages bambam-session.desktop bambam.desktop
.PHONY: all-manpages
all-manpages: $(LINGUAS:%=bambam.%.6)
.PHONY: install-mo
install-mo: $(LINGUAS:%=install-mo-%)
.PHONY: install-mo-%
install-mo-%: po/%.mo
install -o root -g root -m 0644 -D $< $(PREFIX)/usr/share/locale/$*/LC_MESSAGES/bambam.mo
po/%.po: bambam.pot
msgmerge -U $@ $<
touch $@
po/%.mo: po/%.po
msgfmt -o $@ $<
po/LINGUAS: Makefile po4a.conf
echo $(LINGUAS) > $@
# Pot files:
bambam.pot: bambam-py.pot bambam-man.pot bambam-desktop.pot bambam-session-desktop.pot
msgcat $^ > $@
bambam-py.pot: bambam.py Makefile
xgettext -d bambam [email protected] --package-name bambam --package-version $(VERSION) -o $@ -kN_ -c $<
%-desktop.pot: %.en.desktop Makefile
xgettext -d bambam [email protected] --package-name bambam --package-version $(VERSION) -o $@ -c $<
bambam-man.pot: bambam.6
po4a-updatepo -f man -m $< -p $@
# Localized artifacts:
bambam.%.6: po/%.po bambam.6
po4a-translate -f man -m bambam.6 -p $< -l $@
%.desktop: %.en.desktop $(LINGUAS:%=po/%.mo) po/LINGUAS
msgfmt --desktop --template $< -d po/ -o $@
.PHONY: clean
clean:
rm -f $(LINGUAS:%=po/%.mo) po/LINGUAS
# From https://docs.weblate.org/pl/latest/faq.html#merge
.PHONY: resolve-conflicts-in-po-files
resolve-conflicts-in-po-files:
for PO in `find . -name '*.po'` ; do \
lang=$${PO##*/}; lang=$${lang%.po}; \
msgcat --use-first ../app-and-manpage/$$PO $$PO -o $$PO.merge; \
msgmerge --previous --lang=$$lang $$PO.merge bambam.pot -o $$PO; \
rm $$PO.merge; \
done