forked from actionless/pikaur
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (50 loc) · 1.69 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
# This file is licensed under GPLv3, see https://www.gnu.org/licenses/
LANGS := fr ru pt pt_BR de is tr da nl es zh_CN it ja uk
LOCALEDIR := locale
POTFILE := $(LOCALEDIR)/pikaur.pot
POFILES := $(addprefix $(LOCALEDIR)/,$(addsuffix .po,$(LANGS)))
POTEMPFILES := $(addprefix $(LOCALEDIR)/,$(addsuffix .po~,$(LANGS)))
MOFILES = $(POFILES:.po=.mo)
DISTDIR := dist
# A $(which python) is necessary here to avoid a bug in make that would
# try to execute a directory named "python". See https://savannah.gnu.org/bugs/?57962
PIKAMAN := $(shell which python) ./maintenance_scripts/pikaman.py
README_FILE := README.md
MAN_FILE := pikaur.1
all: locale man bin
locale: $(MOFILES)
man: $(MAN_FILE)
bin: $(DISTDIR)/usr/bin/pikaur
$(POTFILE):
# find pikaur -type f -name '*.py' -not -name 'argparse.py' \
#
find pikaur -type f -name '*.py' \
| xargs xgettext --language=python --add-comments --sort-output \
--default-domain=pikaur --from-code=UTF-8 \
--keyword='translate' --keyword='translate_many:1,2' \
--output=$@
$(LOCALEDIR)/%.po: $(POTFILE)
test -f $@ || msginit --locale=$* --no-translator --input=$< --output=$@
msgmerge --update $@ $<
%.mo: %.po
msgfmt -o $@ $<
$(MAN_FILE): $(README_FILE)
$(PIKAMAN) $< $@
sed -i \
-e '/coveralls/d' \
-e '/Screenshot/d' \
$@
$(DISTDIR)/usr/bin:
mkdir -p $@
$(DISTDIR)/usr/bin/pikaur: $(DISTDIR)/usr/bin
sed \
-e "s/%PYTHON_BUILD_VERSION%/$$(python -c 'import sys ; print(f"{sys.version_info.major}.{sys.version_info.minor}")')/g" \
packaging/usr/bin/pikaur > $@
chmod +x $@
clean:
$(RM) $(LANGS_MO)
$(RM) $(POTEMPFILES)
$(RM) $(MAN_FILE)
$(RM) -r $(DISTDIR)
.PHONY: all clean $(POTFILE) man bin $(DISTDIR)/usr/bin/pikaur
.PRECIOUS: $(LOCALEDIR)/%.po