aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile111
1 files changed, 23 insertions, 88 deletions
diff --git a/Makefile b/Makefile
index b032c34c..3b891920 100644
--- a/Makefile
+++ b/Makefile
@@ -1,100 +1,35 @@
1# 1# This file is in the public domain.
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 2
11# All: build HTML pages in all languages and compile the 3include build-system/config.mk
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 ($(mkdir) -p rendered/.well-known ; $(cp) .well-known/security.txt rendered/.well-known/)
47
48# Extract translateable strings from jinja2 templates.
49# Because of the local i18nfix extractor module we need
50# to set the pythonpath before invoking pybabel.
51locale/messages.pot: common/*.j2.inc template/*.j2
52 $(env) PYTHONPATH="." $(pybabel) -q extract -F locale/babel.map -o locale/messages.pot .
53
54# Update translation (.po) files with new strings.
55locale-update: locale/messages.pot
56 (for lang in en de es fr it; do \
57 $(msgmerge) -q -U -m --previous locale/$$lang/LC_MESSAGES/messages.po locale/messages.pot ; \
58 done)
59 if $(grep) -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then echo -e "\nERROR: Conflicts encountered in PO files.\n"; exit 1; fi
60
61# Compile translation files for use.
62locale-compile:
63 (for lang in en de fr it es; do \
64 $(pybabel) -q compile -d locale -l $$lang --use-fuzzy ; \
65 done)
66 4
67# Process everything related to gettext translations. 5# All: build HTML pages in all languages and compile the
68locale: locale-update locale-compile 6.PHONY: all
69 7all:
70# Run the jinja2 templating engine to expand templates to HTML 8 ./inc/update-messages
71# incorporating translations. 9 env "BASEURL=$(opt_baseurl)" ./inc/build-site
72template: locale-compile
73 $(python) ./make_site.py
74
75it: template
76
77current_dir = $(shell pwd)
78 10
11.PHONY: run
79run: all 12run: all
80 $(browser) http://0.0.0.0:8000/rendered/en & 13 $(browser) http://0.0.0.0:8000/rendered/en &
81 $(python) -m http.server 14 $(python) -m http.server
82 15
16variant = $(opt_variant)
83 17
84# docker-all: Build using a docker image which contains all the needed 18ifndef variant
85# packages. 19$(error variant is not set)
86 20endif
87docker: docker-all
88 21
89docker-all: 22.PHONY: install
90 $(docker) build -t gnunet-www-builder . 23install: all
91 # Importing via the shell like this is hacky, 24 $(mkdir) -p $(prefix)/$(variant)
92 # but after trying lots of other ways, this works most reliably... 25 $(cp) -r rendered/* $(prefix)/$(variant)/
93 $(python) -c 'import i18nfix' 26 $(cp) -r rendered/.well-known/ $(prefix)/$(variant)/
94 $(docker) run --rm -v $$(pwd):/tmp/ --user $$(id -u):$$(id -g) gnunet-www-builder
95 27
28.PHONY: clean
96clean: 29clean:
97 $(rm) -rf __pycache__ 30 $(rm) -rf __pycache__ *.pyc *~ \.*~ \#*\#
98 $(rm) -rf en/ de/ fr/ it/ es/ ru/
99 $(rm) -rf rendered/ 31 $(rm) -rf rendered/
100 $(rm) -rf *.pyc *~ \.*~ \#*\# 32
33.PHONY: submodules/update
34submodules/update:
35 $(git) submodule update --recursive --remote