]>
Commit | Line | Data |
---|---|---|
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 | 21 | PACKAGE_NAME = collecty |
3e1b842d | 22 | PACKAGE_VERSION = 0.0.2 |
a0f510d5 MT |
23 | |
24 | DESTDIR = | |
25 | PREFIX = /usr | |
26 | BINDIR = $(PREFIX)/bin | |
82c136f8 | 27 | SBINDIR = $(PREFIX)/sbin |
a0f510d5 | 28 | LOCALEDIR = $(PREFIX)/share/locale |
9af02219 | 29 | UNITDIR = $(PREFIX)/lib/systemd/system |
a49a4b46 | 30 | |
b0162248 MT |
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/ | |
a49a4b46 | 33 | |
a0f510d5 MT |
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)) | |
a49a4b46 | 43 | |
a0f510d5 | 44 | .PHONY: all |
2924ddb3 MT |
45 | all: $(MO_FILES) |
46 | ||
47 | .PHONY: pot | |
48 | pot: $(POT_FILE) | |
a0f510d5 MT |
49 | |
50 | .PHONY: dist | |
03578120 MT |
51 | dist: |
52 | git archive --format=tar --prefix=$(NAME)-$(VERSION)/ HEAD | gzip -9 \ | |
53 | > $(NAME)-$(VERSION).tar.gz | |
54 | ||
a0f510d5 | 55 | .PHONY: install |
2924ddb3 | 56 | install: $(MO_FILES) |
a49a4b46 MT |
57 | -mkdir -pv $(PYTHON_DIR) |
58 | cp -rvf collecty $(PYTHON_DIR) | |
82c136f8 MT |
59 | |
60 | -mkdir -pv $(DESTDIR)$(SBINDIR) | |
61 | install -v -m 755 collectyd $(DESTDIR)$(SBINDIR) | |
a49a4b46 MT |
62 | |
63 | # Install configuration | |
a0f510d5 MT |
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 | ||
9af02219 MT |
76 | # Install systemd unit files. |
77 | mkdir -pv $(DESTDIR)$(UNITDIR) | |
78 | install -m 644 -v collecty.service $(DESTDIR)$(UNITDIR) | |
79 | ||
a0f510d5 MT |
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. | |
2924ddb3 | 91 | %.mo: %.po |
a0f510d5 | 92 | msgfmt -o $@ $< |