]> git.ipfire.org Git - collecty.git/blob - Makefile
Add plugin to collect traffic data from interfaces.
[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.1
23
24 DESTDIR =
25 PREFIX = /usr
26 BINDIR = $(PREFIX)/bin
27 LOCALEDIR = $(PREFIX)/share/locale
28 UNITDIR = $(PREFIX)/lib/systemd/system
29
30 PYTHON_VER := $(shell python -c "import platform; print '.'.join(platform.python_version_tuple()[:2])")
31 PYTHON_DIR = $(DESTDIR)/usr/lib/python$(PYTHON_VER)/site-packages/
32
33 ###
34 # Translation stuff
35 ###
36 # A list of all files that need translation
37 TRANSLATION_FILES = $(shell find collecty -type f -name "*.py") collectyd
38
39 POT_FILE = po/$(PACKAGE_NAME).pot
40 PO_FILES = $(wildcard po/*.po)
41 MO_FILES = $(patsubst %.po,%.mo,$(PO_FILES))
42
43 .PHONY: all
44 all: $(MO_FILES)
45
46 .PHONY: pot
47 pot: $(POT_FILE)
48
49 .PHONY: dist
50 dist:
51 git archive --format=tar --prefix=$(NAME)-$(VERSION)/ HEAD | gzip -9 \
52 > $(NAME)-$(VERSION).tar.gz
53
54 .PHONY: install
55 install: $(MO_FILES)
56 -mkdir -pv $(PYTHON_DIR)
57 cp -rvf collecty $(PYTHON_DIR)
58 install -v -m 755 collectyd $(DESTDIR)$(BINDIR)
59
60 # Install configuration
61 -mkdir -pv $(DESTDIR)/etc/$(PACKAGE_NAME)
62 cp -vf example.conf $(DESTDIR)/etc/$(PACKAGE_NAME)/$(PACKAGE_NAME).conf
63
64 # Install translation files.
65 -mkdir -pv $(DESTDIR)$(LOCALEDIR)
66 for file in $(MO_FILES); do \
67 lang=$$(basename $${file/.mo/}); \
68 mkdir -pv $(DESTDIR)$(LOCALEDIR)/$${lang}/LC_MESSAGES; \
69 install -v -m 644 $${file} \
70 $(DESTDIR)$(LOCALEDIR)/$${lang}/LC_MESSAGES/$(PACKAGE_NAME).mo; \
71 done
72
73 # Install systemd unit files.
74 mkdir -pv $(DESTDIR)$(UNITDIR)
75 install -m 644 -v collecty.service $(DESTDIR)$(UNITDIR)
76
77 # Cleanup temporary files.
78 .PHONY: clean
79 clean:
80 rm -f $(MO_FILES)
81
82 # Translation stuff.
83 $(POT_FILE): $(TRANSLATION_FILES) Makefile
84 xgettext --language python -d $(PACKAGE_NAME) -k_ -kN_ \
85 -o $@ --add-comments --from-code=UTF-8 $(sort $^)
86
87 # Compile gettext dictionaries from translation files.
88 %.mo: %.po
89 msgfmt -o $@ $<