aboutsummaryrefslogtreecommitdiff
path: root/GNUmakefile
diff options
context:
space:
mode:
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile114
1 files changed, 114 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 00000000..f2c50410
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,114 @@
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: css locale template
23 cp -R dist rendered/
24 cp -R static rendered/
25 cp rendered/static/robots.txt rendered/robots.txt
26 cp rendered/static/stage.robots.txt rendered/stage.robots.txt
27 cp rendered/static/robots.txt rendered/dist/robots.txt
28 cp rendered/static/robots.txt rendered/en/robots.txt
29 cp rendered/static/robots.txt rendered/de/robots.txt
30 cp rendered/static/robots.txt rendered/es/robots.txt
31 cp rendered/static/robots.txt rendered/fr/robots.txt
32 cp rendered/static/robots.txt rendered/it/robots.txt
33 cp favicon.ico rendered/favicon.ico
34 /bin/sh make_sitemap.sh
35 cp rendered/sitemap.xml rendered/en/sitemap.xml
36 cp rss.xml rendered/rss.xml
37 cp rss.xml rendered/en/rss.xml
38 cp rss.xml rendered/de/rss.xml
39 cp rss.xml rendered/es/rss.xml
40 cp rss.xml rendered/fr/rss.xml
41 cp rss.xml rendered/it/rss.xml
42 cp static/moved.html rendered/frontpage.html
43 cd rendered; ln -fs frontpage.html frontpage
44 cp static/moved_gsoc.html rendered/gsoc.html
45 cd rendered; ln -fs gsoc.html gsoc
46 cp static/moved_gns.html rendered/gns.html
47 cd rendered; ln -fs gns.html gns
48 mkdir rendered/node ; cp static/moved_about.html rendered/node/about.html
49 cd rendered/node ; ln -fs about.html 397
50 cp static/moved_about.html rendered/about.html
51 cd rendered ; ln -fs about.html philosophy
52
53# Extract translateable strings from jinja2 templates.
54# Because of the local i18nfix extractor module we need
55# to set the pythonpath before invoking pybabel.
56locale/messages.pot: common/*.j2.inc template/*.j2
57 PYTHONPATH=. $(BABEL) -v extract -F locale/babel.map -o locale/messages.pot .
58
59# Update translation (.po) files with new strings.
60locale-update: locale/messages.pot
61 msgmerge -U -m --previous locale/en/LC_MESSAGES/messages.po locale/messages.pot
62 msgmerge -U -m --previous locale/de/LC_MESSAGES/messages.po locale/messages.pot
63 msgmerge -U -m --previous locale/fr/LC_MESSAGES/messages.po locale/messages.pot
64 msgmerge -U -m --previous locale/es/LC_MESSAGES/messages.po locale/messages.pot
65 msgmerge -U -m --previous locale/it/LC_MESSAGES/messages.po locale/messages.pot
66
67 if grep -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then echo -e "\nERROR: Conflicts encountered in PO files.\n"; exit 1; fi
68
69# sass preprocessor
70css:
71 sassc static/styles.sass static/styles.css
72
73# Compile translation files for use.
74locale-compile:
75 $(BABEL) -v compile -d locale -l en --use-fuzzy
76 $(BABEL) -v compile -d locale -l de --use-fuzzy
77 $(BABEL) -v compile -d locale -l fr --use-fuzzy
78 $(BABEL) -v compile -d locale -l it --use-fuzzy
79 $(BABEL) -v compile -d locale -l es --use-fuzzy
80
81# Process everything related to gettext translations.
82locale: locale-update locale-compile
83
84# Run the jinja2 templating engine to expand templates to HTML
85# incorporating translations.
86template: locale-compile
87 $(PYTHON) ./template.py
88
89it: template
90
91current_dir = $(shell pwd)
92
93run: all
94 @[ "$(BROWSER)" ] || ( echo "You need to export the environment variable 'BROWSER' to run this."; exit 1 )
95 $(RUN_BROWSER) http://0.0.0.0:8000 &
96 cd rendered && $(PYTHON) -m http.server
97
98
99# docker-all: Build using a docker image which contains all the needed packages.
100
101docker: docker-all
102
103docker-all:
104 docker build -t gnunet-www-builder .
105 # Importing via the shell like this is hacky,
106 # but after trying lots of other ways, this works most reliably...
107 $(PYTHON) -c 'import i18nfix'
108 docker run --rm -v $$(pwd):/tmp/ --user $$(id -u):$$(id -g) gnunet-www-builder
109
110clean:
111 rm -rf __pycache__
112 rm -rf en/ de/ fr/ it/ es/ ru/
113 rm -rf rendered/
114 rm -rf *.pyc *~ \.*~ \#*\#