6 INSTALL_DATA := install -m 644
7 INSTALL_PROGRAM := install -m 755
8 INSTALL_DIR := install -m 755 -d
10 TRADUC_DIR = translations
11 TRADUC_DEST = $(DESTDIR)/usr/share/locale
15 PYTHON_OPTS += --root $(DESTDIR)
18 LAST_TAG := $(shell git describe --tags --abbrev=0)
19 VERSION := $(shell echo $(LAST_TAG) | awk -F'/' '{print $$2}' || true)
20 VERSION_FILE := version.in
22 # Build translation files
23 define build_translation
24 if [ -d ${1} ]; then \
25 for f in `find ${1} -name "*.po"`; do \
26 msgfmt -o `dirname $$f`/`basename -s ".po" $$f`.mo $$f || true; \
32 define install_translation
33 if [ -d ${1} ]; then \
34 for file in `find ${1} -name "*.mo"`; do \
35 $(INSTALL_DIR) $(TRADUC_DEST)/`echo $$file | cut -d '/' -f 2` || true; \
36 $(INSTALL_DIR) $(TRADUC_DEST)/`echo $$file | cut -d '/' -f 2`/LC_MESSAGES || true; \
37 $(INSTALL_DATA) $$file $(TRADUC_DEST)/`echo $$file | cut -d '/' -f 2`/LC_MESSAGES || true; \
46 $(RM) -r tiramisu.egg-info/
47 $(RM) -r $(TRADUC_DIR)/*/*.mo
53 $(call build_translation, $(TRADUC_DIR))
55 install-lang: build-lang
56 $(INSTALL_DIR) $(TRADUC_DEST)
57 $(call install_translation, $(TRADUC_DIR))
60 python setup.py install --no-compile $(PYTHON_OPTS)
62 # List in .PHONY to force generation at each call
64 @if test -n $(VERSION) ; then \
65 echo $(VERSION) > $(VERSION_FILE) ; \
69 git archive --format=tar --prefix $(PACKAGE)-$(VERSION)/ -o $(PACKAGE)-$(VERSION).tar $(LAST_TAG) \
70 && tar --xform "s,\(.*\),$(PACKAGE)-$(VERSION)/\1," -f $(PACKAGE)-$(VERSION).tar -r version.in \
71 && gzip -9 $(PACKAGE)-$(VERSION).tar
73 .PHONY: all clean test install version.in dist