summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-10-24 21:39:39 +0200
committerChristian Grothoff <christian@grothoff.org>2020-10-24 21:39:39 +0200
commit8ce0d0f2d65974f98b2792a546734e6742980a1f (patch)
tree4d5812c4700d5de7592bdce23ebfa0a8f74d1df4 /Makefile
parentffbfe901bb434bb5cea9b9b9a2fb55c6f3c4e447 (diff)
downloadauditor-8ce0d0f2d65974f98b2792a546734e6742980a1f.tar.gz
auditor-8ce0d0f2d65974f98b2792a546734e6742980a1f.tar.bz2
auditor-8ce0d0f2d65974f98b2792a546734e6742980a1f.zip
some minimal love for the auditor page, not working yet though
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile80
1 files changed, 40 insertions, 40 deletions
diff --git a/Makefile b/Makefile
index 6992536..7b94180 100644
--- a/Makefile
+++ b/Makefile
@@ -1,70 +1,70 @@
# 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 build-system/config.mk
-include config.mk
+# List of all supported languages, add new languages here!
+LANGUAGES="en"
# All: build HTML pages in all languages and compile the
# TypeScript logic in web-common.
+.PHONY: all
all: locale template
-# cd web-common && $(TSC)
-
-requirements:
- pip3 install --user -r requirements.txt
+ (cd web-common && $(tsc))
+ (for lang in `echo $(LANGUAGES)` ; do \
+ $(cp) -R web-common/*.css web-common/*.ico rendered/static/ ; \
+ done)
# Extract translateable strings from jinja2 templates.
-locale/messages.pot: requirements *.j2 # common/*.j2 common/*.j2.inc
- env PYTHONPATH="." $(BABEL) extract -F locale/babel.map -o locale/messages.pot .
+locale/messages.pot: template/*.j2
+ $(python) inc/mybabel.py $(pybabel) extract -F locale/babel.map -o locale/messages.pot .
# Update translation (.po) files with new strings.
+.PHONY: locale-update
locale-update: locale/messages.pot
- msgmerge -U -m --previous locale/en/LC_MESSAGES/messages.po locale/messages.pot
+ (for lang in `echo $(LANGUAGES)`; do \
+ $(msgmerge) -q -U -m --previous locale/$$lang/LC_MESSAGES/messages.po locale/messages.pot ; \
+ done)
- @if grep -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then echo -e "\nERROR: Conflicts encountered in PO files.\n"; exit 1; fi
+ 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.
+.PHONY: locale-compile
locale-compile:
- $(BABEL) compile -d locale -l en --use-fuzzy
+ (for lang in `echo $(LANGUAGES)`; do \
+ $(pybabel) -q compile -d locale -l $$lang --use-fuzzy ; \
+ done)
# Process everything related to gettext translations.
+.PHONY: locale
locale: locale-update locale-compile
# Run the jinja2 templating engine to expand templates to HTML
# incorporating translations.
template: locale-compile
- $(PYTHON) ./template.py
+ $(python) ./make_site.py
+.PHONY: run
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
+ $(browser) http://0.0.0.0:8000/rendered/en &
+ $(python) -m http.server
-clean:
- rm -rf __pycache__
- rm -rf en/ de/ fr/ it/ es/ ru/
- rm -rf rendered/
+ifndef variant
+$(error variant is not set)
+endif
-submodules/init:
- git submodule update --init --recursive
+.PHONY: install
+install: all
+ $(mkdir) -p $(prefix)/$(variant)
+ $(cp) -r rendered/* $(prefix)/$(variant)/
-submodules/update:
- git submodule update --recursive --remote
+.PHONY: uninstall
+uninstall:
+ $(rm) -rf $(prefix)/$(variant)
-.SILENT: show-help
+.PHONY: clean
+clean:
+ $(rm) -rf __pycache__ *.pyc *~ \.*~ \#*\#
+ $(rm) -rf rendered/
-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"
+submodules/update:
+ $(git) submodule update --recursive --remote