]> git.ipfire.org Git - oddments/ddns.git/blame_incremental - Makefile
Update providers so they don't need to format the request URL.
[oddments/ddns.git] / Makefile
... / ...
CommitLineData
1
2PACKAGE_NAME = ddns
3PACKAGE_VERSION = 0.01
4
5DESTDIR =
6PREFIX = /usr
7SYSCONFDIR = /etc
8BINDIR = $(PREFIX)/bin
9LIBDIR = $(PREFIX)/lib
10LOCALEDIR = $(PREFIX)/share/locale
11
12# Get the version and configuration of the python interpreter.
13PYTHON_VERSION = $(shell python -c "import platform; print '.'.join(platform.python_version_tuple()[:2])")
14ifeq "$(PYTHON_VERSION)" ""
15 $(error Could not determine the version of the python interpreter.)
16endif
17PYTHON_DIR = $(LIBDIR)/python$(PYTHON_VERSION)/site-packages/ddns
18
19VERSION_FILE = ddns/__version__.py
20
21###
22# Translation stuff
23###
24# A list of all files that need translation
25TRANSLATION_FILES = $(wildcard ddns/*.py) ddns.py
26
27POT_FILE = po/$(PACKAGE_NAME).pot
28PO_FILES = $(wildcard po/*.po)
29MO_FILES = $(patsubst %.po,%.mo,$(PO_FILES))
30
31################################################################################
32
33all: $(POT_FILE) $(MO_FILES)
34 @: # Do nothing else.
35
36$(VERSION_FILE): Makefile
37 echo "# this file is autogenerated by the build system" > $(VERSION_FILE)
38 echo "CLIENT_VERSION = \"$(PACKAGE_VERSION)\"" >> $(VERSION_FILE)
39
40install: $(VERSION_FILE) $(MO_FILES)
41 # Install the main command.
42 -mkdir -pv $(DESTDIR)$(BINDIR)
43 install -v -m 755 ddns.py $(DESTDIR)$(BINDIR)/ddns
44
45 # Install python module.
46 -mkdir -pv $(DESTDIR)$(PYTHON_DIR)
47 install -v -m 644 ddns/*.py $(DESTDIR)$(PYTHON_DIR)
48
49 # Install the example configuration file.
50 -mkdir -pv $(DESTDIR)$(SYSCONFDIR)
51 install -v -m 640 ddns.conf $(DESTDIR)$(SYSCONFDIR)/ddns.conf
52
53 # Install translation files.
54 -mkdir -pv $(DESTDIR)$(LOCALEDIR)
55 for file in $(MO_FILES); do \
56 lang=$${file/.mo/}; \
57 mkdir -pv $(DESTDIR)$(LOCALEDIR)/$${lang}/LC_MESSAGES; \
58 install -v -m 644 $${file} \
59 $(DESTDIR)$(LOCALEDIR)/$${lang}/LC_MESSAGES/$(PACKAGE_NAME).mo; \
60 done
61
62# Cleanup temporary files.
63clean:
64 rm -f $(VERSION_FILE)
65 rm -f $(MO_FILES)
66
67# Translation stuff.
68$(POT_FILE): $(TRANSLATION_FILES) Makefile
69 xgettext --language python -d $(PACKAGE_NAME) -k_ -kN_ \
70 -o $@ --add-comments --from-code=UTF-8 $^
71
72# Compile gettext dictionaries from translation files.
73%.mo: %.po $(POT_FILE)
74 msgfmt -o $@ $<