From 4b89f63bd47dfb0c77dfdc6aacb89e08ec59f9d2 Mon Sep 17 00:00:00 2001 From: ng0 Date: Sun, 3 Mar 2019 09:59:51 +0000 Subject: Makefile: make it configurable to adjust to differences in operating systems and their binary names of pybabel and python. --- Makefile | 27 ++++++++++++++++++--------- config.mk | 6 ++++++ 2 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 config.mk diff --git a/Makefile b/Makefile index 3b7a5439..0e7d450a 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,14 @@ # This file is in the public domain. +# Hardly anyone seems to read README files anymore, so keep this note here: +# Don't remove the variables for python etc. They exist +# because one system sticks with PEPs, and others opt +# for installing every version side-by-side, +# Same goes for babel. + +include config.mk + + # All: build HTML pages in all languages and compile the # TypeScript logic in web-common. all: locale template @@ -7,7 +16,7 @@ all: locale template # Extract translateable strings from jinja2 templates. locale/messages.pot: *.j2 common/*.j2 common/*.j2.inc - env PYTHONPATH="." pybabel extract -F locale/babel.map -o locale/messages.pot . + env PYTHONPATH="." $(BABEL) extract -F locale/babel.map -o locale/messages.pot . # Update translation (.po) files with new strings. locale-update: locale/messages.pot @@ -23,13 +32,13 @@ locale-update: locale/messages.pot # Compile translation files for use. locale-compile: - pybabel compile -d locale -l en --use-fuzzy - pybabel compile -d locale -l de --use-fuzzy - pybabel compile -d locale -l fr --use-fuzzy - pybabel compile -d locale -l it --use-fuzzy - pybabel compile -d locale -l es --use-fuzzy - pybabel compile -d locale -l ru --use-fuzzy - pybabel compile -d locale -l pt --use-fuzzy + $(BABEL) compile -d locale -l en --use-fuzzy + $(BABEL) compile -d locale -l de --use-fuzzy + $(BABEL) compile -d locale -l fr --use-fuzzy + $(BABEL) compile -d locale -l it --use-fuzzy + $(BABEL) compile -d locale -l es --use-fuzzy + $(BABEL) compile -d locale -l ru --use-fuzzy + $(BABEL) compile -d locale -l pt --use-fuzzy # Process everything related to gettext translations. locale: locale-update locale-compile @@ -37,4 +46,4 @@ locale: locale-update locale-compile # Run the jinja2 templating engine to expand templates to HTML # incorporating translations. template: locale-compile - ./template.py + $(PYTHON) ./template.py diff --git a/config.mk b/config.mk new file mode 100644 index 00000000..032e41d9 --- /dev/null +++ b/config.mk @@ -0,0 +1,6 @@ +# config.mk Makefile fragment to set custom variables. + +PYTHON=python3 +BABEL=pybabel + +RUN_BROWSER=$(BROWSER) -- cgit v1.2.3