PACKAGE_NAME = ddns PACKAGE_VERSION = 0.01 DESTDIR = PREFIX = /usr SYSCONFDIR = /etc BINDIR = $(PREFIX)/bin LIBDIR = $(PREFIX)/lib LOCALEDIR = $(PREFIX)/share/locale # Get the version and configuration of the python interpreter. PYTHON_VERSION = $(shell python -c "import platform; print '.'.join(platform.python_version_tuple()[:2])") ifeq "$(PYTHON_VERSION)" "" $(error Could not determine the version of the python interpreter.) endif PYTHON_DIR = $(LIBDIR)/python$(PYTHON_VERSION)/site-packages/ddns VERSION_FILE = ddns/__version__.py ### # Translation stuff ### # A list of all files that need translation TRANSLATION_FILES = $(wildcard ddns/*.py) ddns.py POT_FILE = po/$(PACKAGE_NAME).pot PO_FILES = $(wildcard po/*.po) MO_FILES = $(patsubst %.po,%.mo,$(PO_FILES)) ################################################################################ all: $(POT_FILE) $(MO_FILES) @: # Do nothing else. $(VERSION_FILE): Makefile echo "# this file is autogenerated by the build system" > $(VERSION_FILE) echo "CLIENT_VERSION = \"$(PACKAGE_VERSION)\"" >> $(VERSION_FILE) install: $(VERSION_FILE) $(MO_FILES) # Install the main command. -mkdir -pv $(DESTDIR)$(BINDIR) install -v -m 755 ddns.py $(DESTDIR)$(BINDIR)/ddns # Install python module. -mkdir -pv $(DESTDIR)$(PYTHON_DIR) install -v -m 644 ddns/*.py $(DESTDIR)$(PYTHON_DIR) # Install the example configuration file. -mkdir -pv $(DESTDIR)$(SYSCONFDIR) install -v -m 640 ddns.conf $(DESTDIR)$(SYSCONFDIR)/ddns.conf # Install translation files. -mkdir -pv $(DESTDIR)$(LOCALEDIR) for file in $(MO_FILES); do \ lang=$${file/.mo/}; \ mkdir -pv $(DESTDIR)$(LOCALEDIR)/$${lang}/LC_MESSAGES; \ install -v -m 644 $${file} \ $(DESTDIR)$(LOCALEDIR)/$${lang}/LC_MESSAGES/$(PACKAGE_NAME).mo; \ done # Cleanup temporary files. clean: rm -f $(VERSION_FILE) rm -f $(MO_FILES) # Translation stuff. $(POT_FILE): $(TRANSLATION_FILES) Makefile xgettext --language python -d $(PACKAGE_NAME) -k_ -kN_ \ -o $@ --add-comments --from-code=UTF-8 $^ # Compile gettext dictionaries from translation files. %.mo: %.po $(POT_FILE) msgfmt -o $@ $<