diff options
author | Florian Dold <florian@dold.me> | 2021-05-07 14:40:20 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-05-07 14:40:31 +0200 |
commit | 2590d9989d3d3becc1026f579677cfdf95a77351 (patch) | |
tree | 2f5cb238b2304d6e6babda54773494c1c898e084 /Makefile | |
parent | 8246e1dc4e01cff390fde6583bd502d9b4edab0b (diff) | |
download | anastasis-www-2590d9989d3d3becc1026f579677cfdf95a77351.tar.gz anastasis-www-2590d9989d3d3becc1026f579677cfdf95a77351.tar.bz2 anastasis-www-2590d9989d3d3becc1026f579677cfdf95a77351.zip |
restructure to work with current site generator
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 71 |
1 files changed, 23 insertions, 48 deletions
@@ -3,87 +3,62 @@ include build-system/config.mk # List of all supported languages, add new languages here! -LANGUAGES="en de fr es it ru pt" +LANGUAGES="de en es fr it pt ru" # All: build HTML pages in all languages and compile the -# TypeScript logic in web-common. .PHONY: all all: locale template - ($(cp) rendered/static/robots.txt rendered/robots.txt) - (for lang in `echo $(LANGUAGES)` ; do \ - $(cp) rendered/static/robots.txt rendered/$$lang/robots.txt; \ - done) - ($(python) inc/make_sitemap.py -i rendered) - ($(cp) sitemap.xml rendered/sitemap.xml) - ($(cp) sitemap.xml rendered/en/sitemap.xml) - (for lang in `echo $(LANGUAGES)` ; do \ - $(cp) rendered/sitemap.xml rendered/$$lang ; \ - done) - ($(cp) -R images rendered/static/) - (for lang in `echo $(LANGUAGES)` ; \ - do $(cp) -R images rendered/$$lang ; \ - done) - (for lang in `echo $(LANGUAGES)` ; do \ - $(cp) -R web-common rendered/$$lang ; \ - done) - (cd rendered; \ - for lang in `echo $(LANGUAGES)`; do \ - $(cp) $$lang/rss.xml $$lang/news/rss.xml; \ - done) - (for d in icons papers presentations ; do \ - $(cp) -R $$d rendered/ ; \ - done) - ($(cp) -R pdf rendered/static/) - ($(mkdir) -p rendered/.well-known ; $(cp) .well-known/security.txt rendered/.well-known/) + env BASEURL=$(opt_baseurl) ./inc/make_site.py # Extract translateable strings from jinja2 templates. -locale/messages.pot: template/*.j2 common/*.j2 common/*.j2.inc - $(python) inc/mybabel.py $(pybabel) extract -F locale/babel.map -o locale/messages.pot . +locale/messages.pot: template/*.j2 template/news/*.j2 common/*.j2 common/*.j2.inc + env PYTHONPATH=$$PWD/inc:$$PYTHONPATH $(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 - (for lang in `echo $(LANGUAGES)`; do \ + 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 + done + 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: - (for lang in `echo $(LANGUAGES)`; do \ + for lang in `echo $(LANGUAGES)`; do \ + echo compiling $$lang; \ $(pybabel) -q compile -d locale -l $$lang --use-fuzzy ; \ - done) + 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 - env BASEURL=$(opt_baseurl) ./make_site.py - .PHONY: run run: all $(browser) http://0.0.0.0:8000/rendered/en & $(python) -m http.server +variant = $(opt_variant) + +ifndef variant +$(error variant is not set) +endif + .PHONY: install install: all - $(mkdir) -p $(prefix)/ - $(cp) -r rendered/* $(prefix)/ - $(cp) -r rendered/.well-known/ $(prefix)/ - -.PHONY: uninstall -uninstall: - $(rm) -rf $(prefix)/ + $(mkdir) -p $(prefix)/$(variant) + $(cp) -r rendered/* $(prefix)/$(variant)/ + $(cp) -r rendered/.well-known/ $(prefix)/$(variant)/ .PHONY: clean clean: $(rm) -rf __pycache__ *.pyc *~ \.*~ \#*\# $(rm) -rf rendered/ +.PHONY: submodules/update submodules/update: $(git) submodule update --recursive --remote |