summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorng0 <ng0@taler.net>2019-10-28 16:14:47 +0000
committerng0 <ng0@taler.net>2019-10-28 16:14:47 +0000
commit9f5203986ad2f05d270f9e9ff7e9e9b9f0d01f85 (patch)
tree4c5916283d6a032450d3020346524ae5ce98c4b1 /Makefile
parent39faa523cf8bbb989eea5367743d3c656127a6d5 (diff)
downloadwww-9f5203986ad2f05d270f9e9ff7e9e9b9f0d01f85.tar.gz
www-9f5203986ad2f05d270f9e9ff7e9e9b9f0d01f85.tar.bz2
www-9f5203986ad2f05d270f9e9ff7e9e9b9f0d01f85.zip
Makefile: provide NetBSD make / bmake variant. GNUmake will find "GNUmakefile" first.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile113
1 files changed, 50 insertions, 63 deletions
diff --git a/Makefile b/Makefile
index ac50510..cf83a97 100644
--- a/Makefile
+++ b/Makefile
@@ -1,56 +1,51 @@
+# Makefile for NetBSD make (portable version: "bmake"),
+# GNU make will find 'GNUmakefile' first and use that file instead.
# 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"
-include config.mk
+DESTDIR=$(prefix)
+
+_LOCALELIST= en de fr it es ru pt
+_DIRLIST= dist icons papers pdf presentations images
+
+.PHONY: all run locale-compile locale install clean
+
+# Work this into an mk file
# All: build HTML pages in all languages and compile the
# TypeScript logic in web-common.
all: locale template
- cd web-common && $(TSC)
- /bin/sh make_sitemap.sh
- for x in en de fr it es ru pt ; do cp robots.txt rendered/$$x ; done
- for x in en de fr it es ru pt ; do cp favicon.ico rendered/$$x ; done
- for x in en de fr it es ru pt ; do cp rendered/sitemap.xml rendered/$$x ; done
- cp styles.css rendered/
- cp -R images rendered/
- for x in en de fr it es ru pt ; do cp -R images rendered/$$x ; done
- for x in en de fr it es ru pt ; do cp -R web-common rendered/$$x ; done
- cp -R dist rendered/
- cp -R icons rendered/
- cp -R papers rendered/
- cp -R pdf rendered/
- cp -R presentations rendered/
+ cd web-common && $(tsc)
+ $(sh) make_sitemap.sh
+.for _lang in ${_LOCALELIST}
+ $(cp) robots.txt rendered/${_lang}
+ $(cp) favicon.ico rendered/${_lang}
+ $(cp) rendered/sitemap.xml rendered/${_lang}
+.endfor
+.for _dir in ${_DIRLIST}
+ $(cp) -R ${_dir} rendered/
+.endfor
+ $(cp) styles.css rendered/
# Extract translateable strings from jinja2 templates.
locale/messages.pot: template/*.j2 common/*.j2 common/*.j2.inc
- env PYTHONPATH="." $(BABEL) extract -F locale/babel.map -o locale/messages.pot .
+ $(env) PYTHONPATH="." $(pybabel) extract -F locale/babel.map -o locale/messages.pot .
# Update translation (.po) files with new strings.
locale-update: locale/messages.pot
- msgmerge -U -m --previous locale/en/LC_MESSAGES/messages.po locale/messages.pot
- msgmerge -U -m --previous locale/de/LC_MESSAGES/messages.po locale/messages.pot
- msgmerge -U -m --previous locale/fr/LC_MESSAGES/messages.po locale/messages.pot
- msgmerge -U -m --previous locale/es/LC_MESSAGES/messages.po locale/messages.pot
- msgmerge -U -m --previous locale/it/LC_MESSAGES/messages.po locale/messages.pot
- msgmerge -U -m --previous locale/ru/LC_MESSAGES/messages.po locale/messages.pot
- msgmerge -U -m --previous locale/pt/LC_MESSAGES/messages.po locale/messages.pot
-
- if grep -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then echo -e "\nERROR: Conflicts encountered in PO files.\n"; exit 1; fi
+.for _lang in ${_LOCALELIST}
+ $(msgmerge) -U -m --previous locale/${_lang}/LC_MESSAGES/messages.po locale/messages.pot
+.endfor
+ if $(grep) -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then \
+ $(echo) -e "\nERROR: Conflicts encountered in PO files.\n"; exit 1; \
+ fi
# Compile translation files for use.
locale-compile:
- $(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
+.for _lang in ${_LOCALELIST}
+ $(pybabel) compile -d locale -l ${_lang} --use-fuzzy
+.endfor
# Process everything related to gettext translations.
locale: locale-update locale-compile
@@ -58,35 +53,27 @@ locale: locale-update locale-compile
# Run the jinja2 templating engine to expand templates to HTML
# incorporating translations.
template: locale-compile
- $(PYTHON) ./template.py
+ $(python) ./template.py
-run: all
- @[ "$(BROWSER)" ] || ( echo "You need to export the environment variable 'BROWSER' to run this."; exit 1 )
- $(RUN_BROWSER) http://0.0.0.0:8000 &
- # cd rendered && $(PYTHON) -m http.server
- $(PYTHON) -m http.server
+run:
+.if defined(browser) && !empty(DESTDIR) && !empty(python)
+ $(browser) http://0.0.0.0:8000 &
+ $(python) -m http.server
+.endif
-clean:
- rm -rf __pycache__ *.pyc *~ \.*~ \#*\#
- rm -rf en/ de/ fr/ it/ es/ ru/
- rm -rf rendered/
+install:
+ $(mkdir) -p $(prefix)/share/taler-www
+ $(cp) -R rendered/* $(prefix)/share/taler-www
+
+uninstall:
+ $(rm) -rf $(prefix)/share/taler-www
submodules/init:
- git submodule update --init --recursive
+ $(git) submodule update --init --recursive
submodules/update:
- git submodule update --recursive --remote
-
-.SILENT: show-help
-
-show-help:
- printf "all:\t\t\tBuild the website\n"
- printf "locale/messages.pot:\tExtract translateable strings from jinja2 templates.\n"
- printf "locale-update:\t\tUpdate translation files with new strings.\n"
- printf "locale-compile:\t\tCompile translation files for use.\n"
- printf "locale:\t\t\tProcess everything related to gettext translations.\n"
- printf "template:\t\texpand jinja2 templates to html.\n"
- printf "run:\t\t\tspawn python webserver and open the current directory.\n"
- printf "clean:\t\t\tclean.\n"
- printf "submodules/init:\tinit git submodules\n"
- printf "submodules/update:\tupdate git submodules\n"
+ $(git) submodule update --recursive --remote
+
+CLEANFILES+= *.pyc *~ \.*~ *.core
+
+.include <bsd.prog.mk>