-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile
108 lines (76 loc) · 3.59 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
STATIC=index.html style.css logo.png
BUILD=build/js/main.js $(foreach S, $(STATIC), build/$(S))
SITEFILES=public/style.css public/img/computers-in-our-lives.jpg public/img/appleIIe.jpg public/img/youtube.png public/logo.svg public/logo.png
SITEFILES_DEST=$(foreach S, $(SITEFILES), slingcode.net/$(S))
DISTFILES=index.html publish.html screencasts.html slingcode.html license.txt revision.txt ENV Procfile Makefile nginx.conf
DEFAULTAPPS=hello-world chromium-dinosaur-game preact-demo mithril-todomvc savings-calculator widgets-order-form leaflet-map banana-dungeon-game jquery-ui-demo party-like-its-98 text-log 8bit-interface
# DEBUGFLAG=$(if $(DEBUG), --debug,)
DEBUGFLAG=--debug
# bootleg stuff
BOOTLEGVERSION=0.1.7
BOOTLEG=./bin/bootleg-$(BOOTLEGVERSION)
slingcode.net: $(foreach D, $(DISTFILES), slingcode.net/$(D))
slingcode.net/slingcode.html: $(BOOTLEG) $(BUILD) build/logo-b64-href.txt build/style.min.css src/slingcode/revision.txt build/index.html
$(BOOTLEG) src/slingcode-bootleg.clj > build/slingcode-compiled.html
npx minify build/slingcode-compiled.html > $@
slingcode.net/index.html: $(BOOTLEG) src/slingcode-site-bootleg.clj README.md src/slingcode-static.html build/index.html $(SITEFILES_DEST)
$(BOOTLEG) src/slingcode-site-bootleg.clj README.md > $@
slingcode.net/publish.html: $(BOOTLEG) src/slingcode-site-bootleg.clj pages/publish.md src/slingcode-static.html build/index.html $(SITEFILES_DEST)
$(BOOTLEG) src/slingcode-site-bootleg.clj pages/publish.md > $@
slingcode.net/screencasts.html: $(BOOTLEG) src/slingcode-site-bootleg.clj pages/screencasts.md src/slingcode-static.html build/index.html $(SITEFILES_DEST)
$(BOOTLEG) src/slingcode-site-bootleg.clj pages/screencasts.md > $@
slingcode.net/public/%: public/%
@mkdir -p `dirname $@`
cp $< $@
slingcode.net/ENV: src/site/ENV
cp $< $@
slingcode.net/Procfile: src/site/Procfile
cp $< $@
slingcode.net/Makefile: src/site/Makefile
cp $< $@
slingcode.net/nginx.conf: src/site/nginx.conf
cp $< $@
slingcode.net/license.txt: license.txt
cp $< $@
build/logo-b64-href.txt: build/logo.png
echo "data:image/png;base64,"`base64 $< -w0` > $@
build/style.min.css: build/style.css
npx minify $< > $@
build/js/main.js: $(shell find src) node_modules shadow-cljs.edn src/default-apps.zip.b64
npx shadow-cljs release app $(DEBUGFLAG)
build/style.css: public/*.css
cat public/codemirror.css public/erlang-dark.css public/dialog.css public/style.css > $@
build/%: public/%
@mkdir -p `dirname $@`
cp $< $@
src/default-apps.zip.b64: src/default-apps.zip
base64 $< > $@
src/default-apps.zip: $(foreach Z, $(DEFAULTAPPS), src/default-apps/$(Z).zip )
rm -f $@
cd src/default-apps && zipmerge ../default-apps.zip $(foreach Z, $(DEFAULTAPPS), $(Z).zip )
slingcode.net/revision.txt: src/slingcode/revision.txt
cp $< $@
src/slingcode/revision.txt: .git/index
git rev-parse HEAD | cut -b -16 > $@
node_modules: package.json
npm i
touch node_modules
BOOTLEGTAR=bootleg-$(BOOTLEGVERSION)-linux-amd64.tgz
BOOTLEGURL=https://github.com/retrogradeorbit/bootleg/releases/download/v${BOOTLEGVERSION}/${BOOTLEGTAR}
$(BOOTLEG):
@echo "Installing bootleg."
mkdir -p bin
wget $(BOOTLEGURL) -O $(BOOTLEGTAR)
tar -zxvf $(BOOTLEGTAR) && mv bootleg $(BOOTLEG)
rm $(BOOTLEGTAR)
# dev targets
.PHONY: watch clean
watch: src/slingcode/revision.txt src/default-apps.zip.b64 node_modules
npx shadow-cljs watch app
watch-site: slingcode.net/index.html slingcode.net/publish.html $(SITEFILES_DEST)
cd slingcode.net && live-server --no-browser --port=8000 --wait=500 &
while true; do $(MAKE) -q || $(MAKE); sleep 0.5; done
repl:
npx shadow-cljs cljs-repl app
clean:
rm -rf build/*