2012-07-13 11:22:00 +02:00
|
|
|
#!/usr/bin/make
|
|
|
|
|
2012-07-24 14:13:27 +02:00
|
|
|
PACKAGE := tiramisu
|
2016-04-07 15:53:48 +02:00
|
|
|
ifeq ($(PACKAGE_DST),)
|
|
|
|
PACKAGE_DST := $(PACKAGE)
|
|
|
|
endif
|
2012-07-24 14:13:27 +02:00
|
|
|
|
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
|
|
|
|
|
2013-09-02 15:06:55 +02:00
|
|
|
VERSION := `cat VERSION`
|
|
|
|
|
|
|
|
define gettext
|
|
|
|
if command -v pygettext >/dev/null 2>&1 ; then \
|
|
|
|
P="pygettext" ; \
|
|
|
|
else \
|
|
|
|
P="pygettext.py" ; \
|
|
|
|
fi ; \
|
|
|
|
$$P -p translations/ -o $(PACKAGE).pot `find $(PACKAGE)/ -name "*.py"`
|
2013-09-16 14:52:42 +02:00
|
|
|
endef
|
2012-07-24 14:13:27 +02:00
|
|
|
|
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 \
|
2013-09-16 14:43:58 +02:00
|
|
|
msgfmt -o `dirname $$f`/`basename $$f ".po"`.mo $$f || true; \
|
2013-04-23 16:20:02 +02:00
|
|
|
done; \
|
|
|
|
fi
|
|
|
|
endef
|
|
|
|
|
2013-09-02 15:06:55 +02:00
|
|
|
|
|
|
|
|
2013-04-23 16:20:02 +02:00
|
|
|
# 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; \
|
2016-04-07 15:53:48 +02:00
|
|
|
$(INSTALL_DATA) $$file $(TRADUC_DEST)/`echo $$file | cut -d '/' -f 2`/LC_MESSAGES/$(PACKAGE_DST).mo || true; \
|
2013-04-23 16:20:02 +02:00
|
|
|
done; \
|
|
|
|
fi
|
|
|
|
endef
|
|
|
|
|
2013-09-01 23:09:50 +02:00
|
|
|
all: build-lang
|
2012-07-13 11:22:00 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) -r build
|
2013-09-01 23:09:50 +02:00
|
|
|
$(RM) -r $(PACKAGE).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
|
2013-09-02 15:06:55 +02:00
|
|
|
|
2013-08-31 09:54:23 +02:00
|
|
|
build-pot:
|
2013-09-02 15:06:55 +02:00
|
|
|
$(call gettext)
|
2013-08-31 09:54:23 +02:00
|
|
|
|
2013-04-23 16:20:02 +02:00
|
|
|
build-lang:
|
|
|
|
$(call build_translation, $(TRADUC_DIR))
|
|
|
|
|
2013-09-01 23:09:50 +02:00
|
|
|
install-lang:
|
2013-04-23 16:20:02 +02:00
|
|
|
$(INSTALL_DIR) $(TRADUC_DEST)
|
|
|
|
$(call install_translation, $(TRADUC_DIR))
|
|
|
|
|
2013-09-02 15:06:55 +02:00
|
|
|
install: install-lang
|
2012-07-13 11:22:00 +02:00
|
|
|
python setup.py install --no-compile $(PYTHON_OPTS)
|
|
|
|
|
2013-09-01 23:09:50 +02:00
|
|
|
dist:
|
|
|
|
git archive --format=tar --prefix $(PACKAGE)-$(VERSION)/ HEAD | gzip -9 > $(PACKAGE)-$(VERSION).tar.gz
|
|
|
|
|
2013-09-02 15:06:55 +02:00
|
|
|
# List in .PHONY to force generation at each call
|
|
|
|
.PHONY: all clean build-pot build-lang install-lang install dist
|