-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (44 loc) · 1.54 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/make -f
SITE_REMOTE ?= www/
export SITE_TITLE ?= Dalregementets IF
export SUBTITLE ?=
KEYWORDS_BASE ?= idrott, förening, idrottsförening, falun, dalarna
SITE_RSYNC_OPTS ?= -O -e "ssh -i deploy_key"
.PHONY: help build deploy clean
SRC = src
IMG = data/img
export TMPL = templates
#PAGES = $(shell git ls-tree HEAD --name-only -- $(SRC)/*.html 2>/dev/null)
PAGES = $(shell ls -1 -- $(SRC)/*.txt 2>/dev/null)
help:
$(info make build|deploy|clean)
build: $(patsubst $(SRC)/%.txt,build/%.html,$(PAGES)) \
build/img \
build/js/calendar.js \
build/filebrowser-header.html \
build/filebrowser-footer.html
deploy: build
rsync -rLvzc $(SITE_RSYNC_OPTS) build/ data/ $(SITE_REMOTE)
clean:
rm -rf build
build/%.html: $(SRC)/%.txt $(addprefix $(TMPL)/,$(addsuffix .html,header banner footer))
sh build.sh "$(SRC)/$(*).txt" "$(@)"
build/filebrowser-header.html: $(addprefix $(TMPL)/,$(addsuffix .html,header))
mkdir -p build
export PAGE_TITLE="$(SITE_TITLE)"; \
export TITLE="$(SITE_TITLE)"; \
export KEYWORDS="$(KEYWORDS_BASE)"; \
sed -e '/<!-- BANNER -->/d' $(TMPL)/header.html > $@.tmp; \
sed -i -e '/<h1>$$PAGE_TITLE<\/h1>/d' $@.tmp; \
sed -i -e '/<!-- EXTRACSS -->/{r $(TMPL)/filebrowser.html' -e 'd}' $@.tmp; \
sed -i -e 's/id="content"/id="filebrowser"/' $@.tmp; \
echo " <h1>" >> $@.tmp; \
envsubst < $@.tmp > $@; \
rm $@.tmp
build/filebrowser-footer.html: $(addprefix $(TMPL)/,$(addsuffix .html,footer))
mkdir -p build
cp $(TMPL)/footer.html $@
build/img:
sh img.sh $(IMG)
build/js/calendar.js: data/js/buildcalendar.js
sh calendar.sh