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