]> git.ipfire.org Git - collecty.git/blob - Makefile
Update translations - i.e. import pt_BR.
[collecty.git] / Makefile
1 ###############################################################################
2 # #
3 # collecty - A system statistics collection daemon for IPFire #
4 # Copyright (C) 2012 IPFire development team #
5 # #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
18 # #
19 ###############################################################################
20
21 PACKAGE_NAME = collecty
22 PACKAGE_VERSION = 0.0.2
23
24 DESTDIR =
25 PREFIX = /usr
26 BINDIR = $(PREFIX)/bin
27 SBINDIR = $(PREFIX)/sbin
28 LOCALEDIR = $(PREFIX)/share/locale
29 UNITDIR = $(PREFIX)/lib/systemd/system
30
31 PYTHON_VER := $(shell python -c "import platform; print '.'.join(platform.python_version_tuple()[:2])")
32 PYTHON_DIR = $(DESTDIR)/usr/lib/python$(PYTHON_VER)/site-packages/
33
34 ###
35 # Translation stuff
36 ###
37 # A list of all files that need translation
38 TRANSLATION_FILES = $(shell find collecty -type f -name "*.py") collectyd
39
40 POT_FILE = po/$(PACKAGE_NAME).pot
41 PO_FILES = $(wildcard po/*.po)
42 MO_FILES = $(patsubst %.po,%.mo,$(PO_FILES))
43
44 .PHONY: all
45 all: $(MO_FILES)
46
47 .PHONY: pot
48 pot: $(POT_FILE)
49
50 .PHONY: dist
51 dist:
52 git archive --format=tar --prefix=$(NAME)-$(VERSION)/ HEAD | gzip -9 \
53 > $(NAME)-$(VERSION).tar.gz
54
55 .PHONY: install
56 install: $(MO_FILES)
57 -mkdir -pv $(PYTHON_DIR)
58 cp -rvf collecty $(PYTHON_DIR)
59
60 -mkdir -pv $(DESTDIR)$(SBINDIR)
61 install -v -m 755 collectyd $(DESTDIR)$(SBINDIR)
62
63 # Install configuration
64 -mkdir -pv $(DESTDIR)/etc/$(PACKAGE_NAME)
65 cp -vf example.conf $(DESTDIR)/etc/$(PACKAGE_NAME)/$(PACKAGE_NAME).conf
66
67 # Install translation files.
68 -mkdir -pv $(DESTDIR)$(LOCALEDIR)
69 for file in $(MO_FILES); do \
70 lang=$$(basename $${file/.mo/}); \
71 mkdir -pv $(DESTDIR)$(LOCALEDIR)/$${lang}/LC_MESSAGES; \
72 install -v -m 644 $${file} \
73 $(DESTDIR)$(LOCALEDIR)/$${lang}/LC_MESSAGES/$(PACKAGE_NAME).mo; \
74 done
75
76 # Install systemd unit files.
77 mkdir -pv $(DESTDIR)$(UNITDIR)
78 install -m 644 -v collecty.service $(DESTDIR)$(UNITDIR)
79
80 # Cleanup temporary files.
81 .PHONY: clean
82 clean:
83 rm -f $(MO_FILES)
84
85 # Translation stuff.
86 $(POT_FILE): $(TRANSLATION_FILES) Makefile
87 xgettext --language python -d $(PACKAGE_NAME) -k_ -kN_ \
88 -o $@ --add-comments --from-code=UTF-8 $(sort $^)
89
90 # Compile gettext dictionaries from translation files.
91 %.mo: %.po
92 msgfmt -o $@ $<