aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile99
1 files changed, 99 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..e47f3faa
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,99 @@
1#
2# Copyright (C) 2017, 2018, 2019 GNUnet e.V.
3#
4# Copying and distribution of this file, with or without modification,
5# are permitted in any medium without royalty provided the copyright
6# notice and this notice are preserved. This file is offered as-is,
7# without any warranty.
8#
9# ----
10
11# All: build HTML pages in all languages and compile the
12# TypeScript logic in web-common.
13
14# Hardly anyone seems to read README files anymore, so keep this note here:
15# Don't remove the variables for python etc. They exist
16# because one system sticks with PEPs, and others opt
17# for installing every version side-by-side,
18# Same goes for babel.
19
20include config.mk
21
22all: locale template
23 ($(cp) rendered/static/robots.txt rendered/robots.txt)
24 ($(cp) rendered/static/stage.robots.txt rendered/stage.robots.txt)
25 ($(cp) rendered/static/robots.txt rendered/dist/robots.txt)
26 (for lang in en de es fr it ; do \
27 $(cp) rendered/static/robots.txt rendered/$$lang/robots.txt ; \
28 done)
29 ($(python) inc/make_sitemap.py -i rendered)
30 ($(cp) sitemap.xml rendered/sitemap.xml)
31 ($(cp) sitemap.xml rendered/en/sitemap.xml)
32 ($(cp) static/moved.html rendered/frontpage.html)
33 (cd rendered; $(ln) -fs frontpage.html frontpage)
34 ($(cp) static/moved_gsoc.html rendered/gsoc.html)
35 (cd rendered; $(ln) -fs gsoc.html gsoc)
36 ($(cp) static/moved_gns.html rendered/gns.html)
37 (cd rendered; $(ln) -fs gns.html gns)
38 ($(mkdir) -p rendered/node ; $(cp) static/moved_about.html rendered/node/about.html)
39 (cd rendered/node ; $(ln) -fs about.html 397)
40 ($(cp) static/moved_about.html rendered/about.html)
41 (cd rendered ; $(ln) -fs about.html philosophy)
42 (cd rendered; \
43 for lang in en de es fr it; do \
44 $(cp) $$lang/rss.xml $$lang/news/rss.xml; \
45 done)
46
47# Extract translateable strings from jinja2 templates.
48# Because of the local i18nfix extractor module we need
49# to set the pythonpath before invoking pybabel.
50locale/messages.pot: common/*.j2.inc template/*.j2
51 $(env) PYTHONPATH="." $(pybabel) -q extract -F locale/babel.map -o locale/messages.pot .
52
53# Update translation (.po) files with new strings.
54locale-update: locale/messages.pot
55 (for lang in en de es fr it; do \
56 $(msgmerge) -q -U -m --previous locale/$$lang/LC_MESSAGES/messages.po locale/messages.pot ; \
57 done)
58 if $(grep) -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then echo -e "\nERROR: Conflicts encountered in PO files.\n"; exit 1; fi
59
60# Compile translation files for use.
61locale-compile:
62 (for lang in en de fr it es; do \
63 $(pybabel) -q compile -d locale -l $$lang --use-fuzzy ; \
64 done)
65
66# Process everything related to gettext translations.
67locale: locale-update locale-compile
68
69# Run the jinja2 templating engine to expand templates to HTML
70# incorporating translations.
71template: locale-compile
72 $(python) ./make_site.py
73
74it: template
75
76current_dir = $(shell pwd)
77
78run: all
79 $(browser) http://0.0.0.0:8000/rendered/en &
80 $(python) -m http.server
81
82
83# docker-all: Build using a docker image which contains all the needed
84# packages.
85
86docker: docker-all
87
88docker-all:
89 $(docker) build -t gnunet-www-builder .
90 # Importing via the shell like this is hacky,
91 # but after trying lots of other ways, this works most reliably...
92 $(python) -c 'import i18nfix'
93 $(docker) run --rm -v $$(pwd):/tmp/ --user $$(id -u):$$(id -g) gnunet-www-builder
94
95clean:
96 $(rm) -rf __pycache__
97 $(rm) -rf en/ de/ fr/ it/ es/ ru/
98 $(rm) -rf rendered/
99 $(rm) -rf *.pyc *~ \.*~ \#*\#