-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
41 lines (29 loc) · 1.28 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
MAIN_LANG := $(shell ./bin/main_lang)
LANGS := $(shell ./bin/langs)
MACROS := $(shell ./bin/macro_paths $(LANGS))
SITE_TEMPLATES := $(shell [ -f templates/site.html ] && ./bin/site_template_paths $(LANGS))
HTML := $(shell ./bin/paths html $(MAIN_LANG) $(LANGS))
ATOM := $(shell ./bin/paths atom $(MAIN_LANG) $(LANGS))
STATIC_FILES := $(shell [ -d src ] && find src -type f | sed '/\(\.html$$\|\/\.\)/d; s/^src/dst/')
CONF := $(shell [ -f conf/general ] && echo conf/general)
all: $(MACROS) $(SITE_TEMPLATES) $(HTML) $(ATOM) $(STATIC_FILES)
.SECONDEXPANSION:
-include gen/extra_html.mk
-include gen/extra_atom.mk
# Per language preprocessing
$(MACROS): gen/%.macros: conf/i18n/% macros/general $(CONF)
cat macros/general $(CONF) $< > $@
$(SITE_TEMPLATES): gen/%.site.html: gen/%.macros templates/site.html macros/end
./bin/indent templates/site.html | m4 -D ms_lang=$* -D ms_langs="$(LANGS)" $< macros/template macros/end - > $@
# Per target processing
$(HTML): %: $$(MAP_%) $$(if $(SITE_TEMPLATES),gen/$$(L_%).site.html) gen/$$(L_%).macros macros/content
@mkdir -p $$(dirname $@)
./bin/html $< $(L_$*) > $@
$(ATOM): %: $$(MAP_%) gen/$$(L_%).macros macros/content
@mkdir -p $$(dirname $@)
./bin/atom $< $(L_$*) > $@
dst/%: src/%
@mkdir -p $$(dirname $@)
cp $< $@
clean:
@rm -rf dst/* gen