]> git.ipfire.org Git - collecty.git/blame - Makefile
Take running time of plugins into account when calculating interval.
[collecty.git] / Makefile
CommitLineData
cd57e2f3
MT
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###############################################################################
a49a4b46 20
a0f510d5
MT
21PACKAGE_NAME = collecty
22PACKAGE_VERSION = 0.0.1
23
24DESTDIR =
25PREFIX = /usr
26BINDIR = $(PREFIX)/bin
27LOCALEDIR = $(PREFIX)/share/locale
9af02219 28UNITDIR = $(PREFIX)/lib/systemd/system
a49a4b46 29
b0162248
MT
30PYTHON_VER := $(shell python -c "import platform; print '.'.join(platform.python_version_tuple()[:2])")
31PYTHON_DIR = $(DESTDIR)/usr/lib/python$(PYTHON_VER)/site-packages/
a49a4b46 32
a0f510d5
MT
33###
34# Translation stuff
35###
36# A list of all files that need translation
37TRANSLATION_FILES = $(shell find collecty -type f -name "*.py") collectyd
38
39POT_FILE = po/$(PACKAGE_NAME).pot
40PO_FILES = $(wildcard po/*.po)
41MO_FILES = $(patsubst %.po,%.mo,$(PO_FILES))
a49a4b46 42
a0f510d5 43.PHONY: all
2924ddb3
MT
44all: $(MO_FILES)
45
46.PHONY: pot
47pot: $(POT_FILE)
a0f510d5
MT
48
49.PHONY: dist
03578120
MT
50dist:
51 git archive --format=tar --prefix=$(NAME)-$(VERSION)/ HEAD | gzip -9 \
52 > $(NAME)-$(VERSION).tar.gz
53
a0f510d5 54.PHONY: install
2924ddb3 55install: $(MO_FILES)
a49a4b46
MT
56 -mkdir -pv $(PYTHON_DIR)
57 cp -rvf collecty $(PYTHON_DIR)
a0f510d5 58 install -v -m 755 collectyd $(DESTDIR)$(BINDIR)
a49a4b46
MT
59
60 # Install configuration
a0f510d5
MT
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
9af02219
MT
73 # Install systemd unit files.
74 mkdir -pv $(DESTDIR)$(UNITDIR)
75 install -m 644 -v collecty.service $(DESTDIR)$(UNITDIR)
76
a0f510d5
MT
77# Cleanup temporary files.
78.PHONY: clean
79clean:
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.
2924ddb3 88%.mo: %.po
a0f510d5 89 msgfmt -o $@ $<