2012-07-13 11:22:00 +02:00
|
|
|
#!/usr/bin/make
|
|
|
|
|
2012-07-24 14:13:27 +02:00
|
|
|
PACKAGE := tiramisu
|
|
|
|
|
2012-07-13 11:22:00 +02:00
|
|
|
INSTALL := install
|
|
|
|
INSTALL_DATA := install -m 644
|
|
|
|
INSTALL_PROGRAM := install -m 755
|
|
|
|
INSTALL_DIR := install -m 755 -d
|
|
|
|
|
2013-04-23 16:20:02 +02:00
|
|
|
TRADUC_DIR = translations
|
|
|
|
TRADUC_DEST = $(DESTDIR)/usr/share/locale
|
|
|
|
|
2012-07-13 11:22:00 +02:00
|
|
|
PYTHON_OPTS =
|
|
|
|
ifneq ($(DESTDIR),)
|
|
|
|
PYTHON_OPTS += --root $(DESTDIR)
|
|
|
|
endif
|
|
|
|
|
2012-07-24 14:13:27 +02:00
|
|
|
LAST_TAG := $(shell git describe --tags --abbrev=0)
|
|
|
|
VERSION := $(shell echo $(LAST_TAG) | awk -F'/' '{print $$2}' || true)
|
|
|
|
VERSION_FILE := version.in
|
|
|
|
|
2013-04-23 16:20:02 +02:00
|
|
|
# Build translation files
|
|
|
|
define build_translation
|
|
|
|
if [ -d ${1} ]; then \
|
|
|
|
for f in `find ${1} -name "*.po"`; do \
|
|
|
|
msgfmt -o `dirname $$f`/`basename -s ".po" $$f`.mo $$f || true; \
|
|
|
|
done; \
|
|
|
|
fi
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Install Traduction
|
|
|
|
define install_translation
|
|
|
|
if [ -d ${1} ]; then \
|
|
|
|
for file in `find ${1} -name "*.mo"`; do \
|
|
|
|
$(INSTALL_DIR) $(TRADUC_DEST)/`echo $$file | cut -d '/' -f 2` || true; \
|
|
|
|
$(INSTALL_DIR) $(TRADUC_DEST)/`echo $$file | cut -d '/' -f 2`/LC_MESSAGES || true; \
|
|
|
|
$(INSTALL_DATA) $$file $(TRADUC_DEST)/`echo $$file | cut -d '/' -f 2`/LC_MESSAGES || true; \
|
|
|
|
done; \
|
|
|
|
fi
|
|
|
|
endef
|
|
|
|
|
2012-07-24 14:13:27 +02:00
|
|
|
all:
|
2012-07-13 11:22:00 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) -r build
|
|
|
|
$(RM) -r tiramisu.egg-info/
|
2013-04-23 16:20:02 +02:00
|
|
|
$(RM) -r $(TRADUC_DIR)/*/*.mo
|
2012-07-24 14:13:27 +02:00
|
|
|
|
2013-04-23 14:14:19 +02:00
|
|
|
#test: clean
|
|
|
|
# py.test
|
2012-07-24 14:13:27 +02:00
|
|
|
|
2013-08-31 09:54:23 +02:00
|
|
|
# Build or update Portable Object Base Translation for gettext
|
|
|
|
build-pot:
|
|
|
|
pygettext.py -p translations/ -o tiramisu.pot `find tiramisu/ -name "*.py"`
|
|
|
|
|
2013-04-23 16:20:02 +02:00
|
|
|
build-lang:
|
|
|
|
$(call build_translation, $(TRADUC_DIR))
|
|
|
|
|
|
|
|
install-lang: build-lang
|
|
|
|
$(INSTALL_DIR) $(TRADUC_DEST)
|
|
|
|
$(call install_translation, $(TRADUC_DIR))
|
|
|
|
|
2013-07-18 12:23:50 +02:00
|
|
|
install: version.in install-lang
|
2012-07-13 11:22:00 +02:00
|
|
|
python setup.py install --no-compile $(PYTHON_OPTS)
|
|
|
|
|
2012-07-24 14:13:27 +02:00
|
|
|
# List in .PHONY to force generation at each call
|
|
|
|
version.in:
|
|
|
|
@if test -n $(VERSION) ; then \
|
2013-07-18 12:23:50 +02:00
|
|
|
echo -n $(VERSION) > $(VERSION_FILE) ; \
|
|
|
|
fi
|
|
|
|
@if test ! -s $(VERSION_FILE); then \
|
|
|
|
echo -n '0.0-dev' > $(VERSION_FILE); \
|
2012-07-24 14:13:27 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
dist: version.in
|
|
|
|
git archive --format=tar --prefix $(PACKAGE)-$(VERSION)/ -o $(PACKAGE)-$(VERSION).tar $(LAST_TAG) \
|
|
|
|
&& tar --xform "s,\(.*\),$(PACKAGE)-$(VERSION)/\1," -f $(PACKAGE)-$(VERSION).tar -r version.in \
|
|
|
|
&& gzip -9 $(PACKAGE)-$(VERSION).tar
|
|
|
|
|
2013-08-31 09:54:23 +02:00
|
|
|
.PHONY: all clean test install version.in dist build-pot
|