aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile107
1 files changed, 51 insertions, 56 deletions
diff --git a/Makefile b/Makefile
index 4cb7a99b..e47f3faa 100644
--- a/Makefile
+++ b/Makefile
@@ -1,65 +1,67 @@
1# Makefile for NetBSD make (portable version: "bmake"),
2# GNU make will find 'GNUmakefile' first and use that file instead.
3# This file is in the public domain.
4# 1#
5# I keep and maintain this file for personal use, it is faster than 2# Copyright (C) 2017, 2018, 2019 GNUnet e.V.
6# the gmake approach. 3#
7 4# Copying and distribution of this file, with or without modification,
8.include "config.mk" 5# are permitted in any medium without royalty provided the copyright
9 6# notice and this notice are preserved. This file is offered as-is,
10DESTDIR=$(prefix) 7# without any warranty.
11 8#
12_LOCALELIST= en de fr it es 9# ----
13_DIRLIST= dist static
14 10
15.PHONY: all run locale-compile locale install clean 11# All: build HTML pages in all languages and compile the
12# TypeScript logic in web-common.
16 13
17.OBJDIR=rendered 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.
18 19
19# Work this into an mk file 20include config.mk
20 21
21# All: build HTML pages in all languages and compile the
22# TypeScript logic in web-common.
23all: locale template 22all: locale template
24.for _lang in ${_LOCALELIST} 23 ($(cp) rendered/static/robots.txt rendered/robots.txt)
25 ($(cp) rendered/static/robots.txt rendered/${_lang}) 24 ($(cp) rendered/static/stage.robots.txt rendered/stage.robots.txt)
26 ($(cp) rendered/static/stage.robots.txt rendered/${_lang})
27.endfor
28 ($(cp) rendered/static/robots.txt rendered/dist/robots.txt) 25 ($(cp) rendered/static/robots.txt rendered/dist/robots.txt)
29 # ($(cp) favicon.ico rendered/) 26 (for lang in en de es fr it ; do \
30 # $(sh) make_sitemap.sh 27 $(cp) rendered/static/robots.txt rendered/$$lang/robots.txt ; \
28 done)
29 ($(python) inc/make_sitemap.py -i rendered)
31 ($(cp) sitemap.xml rendered/sitemap.xml) 30 ($(cp) sitemap.xml rendered/sitemap.xml)
32 ($(cp) rendered/sitemap.xml rendered/en/sitemap.xml) 31 ($(cp) sitemap.xml rendered/en/sitemap.xml)
33 ($(cp) static/moved.html rendered/frontpage.html) 32 ($(cp) static/moved.html rendered/frontpage.html)
34 (cd rendered; $(ln) -fs frontpage.html frontpage) 33 (cd rendered; $(ln) -fs frontpage.html frontpage)
35 ($(cp) static/moved_gsoc.html rendered/gsoc.html) 34 ($(cp) static/moved_gsoc.html rendered/gsoc.html)
36 (cd rendered; $(ln) -fs gsoc.html gsoc) 35 (cd rendered; $(ln) -fs gsoc.html gsoc)
37 ($(cp) static/moved_gns.html rendered/gns.html) 36 ($(cp) static/moved_gns.html rendered/gns.html)
38 (cd rendered; $(ln) -fs gns.html gns) 37 (cd rendered; $(ln) -fs gns.html gns)
39 ($(mkdir) -p rendered/node; $(cp) static/moved_about.html rendered/node/about.html) 38 ($(mkdir) -p rendered/node ; $(cp) static/moved_about.html rendered/node/about.html)
40 (cd rendered/node ; $(ln) -fs about.html 397) 39 (cd rendered/node ; $(ln) -fs about.html 397)
41 ($(cp) static/moved_about.html rendered/about.html) 40 ($(cp) static/moved_about.html rendered/about.html)
42 (cd rendered ; $(ln) -fs about.html philosophy) 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)
43 46
44# Extract translateable strings from jinja2 templates. 47# Extract translateable strings from jinja2 templates.
45locale/messages.pot: template/*.j2 common/*.j2 common/*.j2.inc 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
46 $(env) PYTHONPATH="." $(pybabel) -q extract -F locale/babel.map -o locale/messages.pot . 51 $(env) PYTHONPATH="." $(pybabel) -q extract -F locale/babel.map -o locale/messages.pot .
47 52
48# Update translation (.po) files with new strings. 53# Update translation (.po) files with new strings.
49locale-update: locale/messages.pot 54locale-update: locale/messages.pot
50.for _lang in ${_LOCALELIST} 55 (for lang in en de es fr it; do \
51 $(msgmerge) -q -U -m --previous locale/${_lang}/LC_MESSAGES/messages.po locale/messages.pot 56 $(msgmerge) -q -U -m --previous locale/$$lang/LC_MESSAGES/messages.po locale/messages.pot ; \
52.endfor 57 done)
53 if $(grep) -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then \ 58 if $(grep) -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then echo -e "\nERROR: Conflicts encountered in PO files.\n"; exit 1; fi
54 $(echo) -e "\nERROR: Conflicts encountered in PO files.\n"; \
55 exit 1; \
56 fi
57 59
58# Compile translation files for use. 60# Compile translation files for use.
59locale-compile: 61locale-compile:
60.for _lang in ${_LOCALELIST} 62 (for lang in en de fr it es; do \
61 $(pybabel) -q compile -d locale -l ${_lang} --use-fuzzy 63 $(pybabel) -q compile -d locale -l $$lang --use-fuzzy ; \
62.endfor 64 done)
63 65
64# Process everything related to gettext translations. 66# Process everything related to gettext translations.
65locale: locale-update locale-compile 67locale: locale-update locale-compile
@@ -67,38 +69,31 @@ locale: locale-update locale-compile
67# Run the jinja2 templating engine to expand templates to HTML 69# Run the jinja2 templating engine to expand templates to HTML
68# incorporating translations. 70# incorporating translations.
69template: locale-compile 71template: locale-compile
70 $(python) ./make_site.py -vvvv 72 $(python) ./make_site.py
71 73
72run: 74it: template
73.if defined(browser) && !empty(DESTDIR) && !empty(python)
74 $(browser) http://0.0.0.0:8000/rendered/en/ &
75 $(python) -m http.server
76.endif
77 75
78install: 76current_dir = $(shell pwd)
79 $(mkdir) -p $(prefix)/share/gnunet-www
80 $(cp) -R rendered/* $(prefix)/share/gnunet-www
81 77
82uninstall: 78run: all
83 $(rm) -rf $(prefix)/share/gnunet-www 79 $(browser) http://0.0.0.0:8000/rendered/en &
80 $(python) -m http.server
84 81
85submodules/init:
86 $(git) submodule update --init --recursive
87 82
88submodules/update: 83# docker-all: Build using a docker image which contains all the needed
89 $(git) submodule update --recursive --remote 84# packages.
90 85
91docker: docker-all 86docker: docker-all
92 87
93docker-all: 88docker-all:
94.if defined(docker)
95 $(docker) build -t gnunet-www-builder . 89 $(docker) build -t gnunet-www-builder .
96 # Importing via the shell like this is hacky, 90 # Importing via the shell like this is hacky,
97 # but after trying lots of other ways, this works most reliably... 91 # but after trying lots of other ways, this works most reliably...
98 $(python) -c 'import i18nfix' 92 $(python) -c 'import i18nfix'
99 $(docker) run --rm -v $$(pwd):/tmp/ --user $$(id -u):$$(id -g) gnunet-www-builder 93 $(docker) run --rm -v $$(pwd):/tmp/ --user $$(id -u):$$(id -g) gnunet-www-builder
100.endif
101
102CLEANFILES+= *.pyc *~ \.*~ *.core
103 94
104.include <bsd.prog.mk> 95clean:
96 $(rm) -rf __pycache__
97 $(rm) -rf en/ de/ fr/ it/ es/ ru/
98 $(rm) -rf rendered/
99 $(rm) -rf *.pyc *~ \.*~ \#*\#