aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile112
1 files changed, 112 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..307d781e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,112 @@
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#
5# I keep and maintain this file for personal use, it is faster than
6# the gmake approach.
7
8.include "config.mk"
9
10DESTDIR=$(prefix)
11
12_LOCALELIST= en de fr it es
13_DIRLIST= dist static
14
15.PHONY: all run locale-compile locale install clean css
16
17.OBJDIR=rendered
18
19# Work this into an mk file
20
21# All: build HTML pages in all languages and compile the
22# TypeScript logic in web-common.
23all: css locale template
24.for _dir in ${_DIRLIST}
25 $(cp) -R ${_dir} rendered/
26.endfor
27.for _lang in ${_LOCALELIST}
28 $(cp) rendered/static/robots.txt rendered/${_lang}
29 $(cp) rendered/static/stage.robots.txt rendered/${_lang}
30 $(cp) rss.xml rendered/${_lang}
31.endfor
32 $(cp) rendered/static/robots.txt rendered/dist/robots.txt
33 $(cp) favicon.ico rendered/
34 $(sh) make_sitemap.sh
35.for _lang in ${_LOCALELIST}
36 $(cp) rendered/sitemap.xml rendered/${_lang}
37.endfor
38 $(cp) static/moved.html rendered/frontpage.html
39 cd rendered; $(ln) -fs frontpage.html frontpage
40 $(cp) static/moved_gsoc.html rendered/gsoc.html
41 cd rendered; $(ln) -fs gsoc.html gsoc
42 $(cp) static/moved_gns.html rendered/gns.html
43 cd rendered; $(ln) -fs gns.html gns
44 $(mkdir) rendered/node ; $(cp) static/moved_about.html rendered/node/about.html
45 cd rendered/node ; $(ln) -fs about.html 397
46 $(cp) static/moved_about.html rendered/about.html
47 cd rendered ; $(ln) -fs about.html philosophy
48
49# Extract translateable strings from jinja2 templates.
50locale/messages.pot: template/*.j2 common/*.j2 common/*.j2.inc
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 ${_LOCALELIST}
56 $(msgmerge) -q -U -m --previous locale/${_lang}/LC_MESSAGES/messages.po locale/messages.pot
57.endfor
58 if $(grep) -nA1 '#-#-#-#-#' locale/*/LC_MESSAGES/messages.po; then \
59 $(echo) -e "\nERROR: Conflicts encountered in PO files.\n"; \
60 exit 1; \
61 fi
62
63# Compile translation files for use.
64locale-compile:
65.for _lang in ${_LOCALELIST}
66 $(pybabel) -q compile -d locale -l ${_lang} --use-fuzzy
67.endfor
68
69# Process everything related to gettext translations.
70locale: locale-update locale-compile
71
72# Run the jinja2 templating engine to expand templates to HTML
73# incorporating translations.
74template: locale-compile
75 $(python) ./template.py
76
77css:
78 $(sassc) static/styles.sass static/styles.css
79
80run:
81.if defined(browser) && !empty(DESTDIR) && !empty(python)
82 $(browser) http://0.0.0.0:8000 &
83 $(python) -m http.server
84.endif
85
86install:
87 $(mkdir) -p $(prefix)/share/gnunet-www
88 $(cp) -R rendered/* $(prefix)/share/gnunet-www
89
90uninstall:
91 $(rm) -rf $(prefix)/share/gnunet-www
92
93submodules/init:
94 $(git) submodule update --init --recursive
95
96submodules/update:
97 $(git) submodule update --recursive --remote
98
99docker: docker-all
100
101docker-all:
102.if defined(docker)
103 $(docker) build -t gnunet-www-builder .
104 # Importing via the shell like this is hacky,
105 # but after trying lots of other ways, this works most reliably...
106 $(python) -c 'import i18nfix'
107 $(docker) run --rm -v $$(pwd):/tmp/ --user $$(id -u):$$(id -g) gnunet-www-builder
108.endif
109
110CLEANFILES+= *.pyc *~ \.*~ *.core
111
112.include <bsd.prog.mk>