forked from wisp-lang/wisp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (66 loc) · 2.06 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
BROWSERIFY = ./node_modules/browserify/bin/cmd.js
MINIFY = ./node_modules/.bin/minify
WISP_CURRENT = node ./bin/wisp.js
FLAGS =
INSTALL_MESSAGE = "You need to run 'npm install' to install build dependencies."
BUILD_DEPS = $(BROWSERIFY) $(MINIFY) ./node_modules/wisp/bin/wisp.js
# set make's source file search path
vpath % src
ifdef verbose
FLAGS = --verbose
endif
ifdef current
WISP = $(WISP_CURRENT)
else
WISP = ./node_modules/wisp/bin/wisp.js
endif
CORE = expander runtime sequence string ast reader compiler analyzer
core: $(CORE) writer escodegen
escodegen: escodegen-writer escodegen-generator
node: core wisp node-engine repl
browser: node core browser-engine dist/wisp.min.js
all: browser
test: core node recompile
$(WISP_CURRENT) ./test/test.wisp $(FLAGS)
$(BUILD_DEPS):
@echo $(INSTALL_MESSAGE)
@exit 1
clean:
rm -rf engine
rm -rf backend
rm -rf dist
rm -f *.js
%.js: %.wisp $(WISP)
@mkdir -p $(dir $@)
$(WISP) --source-uri wisp/$(subst .js,.wisp,$@) < $< > $@
RECOMPILE = backend/escodegen/writer backend/escodegen/generator backend/javascript/writer engine/node engine/browser $(CORE)
recompile: node browser-engine
$(info Recompiling with current version:)
@$(foreach file,$(RECOMPILE),\
echo " $(file)" && \
$(WISP_CURRENT) --source-uri wisp/$(file).wisp < src/$(file).wisp > $(file).js~ && \
mv $(file).js~ $(file).js &&) echo "...done"
### core ###
repl: repl.js
reader: reader.js
compiler: compiler.js
runtime: runtime.js
sequence: sequence.js
string: string.js
ast: ast.js
analyzer: analyzer.js
expander: expander.js
wisp: wisp.js
writer: backend/javascript/writer.js
### escodegen backend ###
escodegen-writer: backend/escodegen/writer.js
escodegen-generator: backend/escodegen/generator.js
### platform engine bundles ###
node-engine: ./engine/node.js
browser-engine: ./engine/browser.js
dist/wisp.js: engine/browser.js $(WISP) $(BROWSERIFY) browserify.wisp core recompile
@mkdir -p dist
$(WISP_CURRENT) browserify.wisp > dist/wisp.js
dist/wisp.min.js: dist/wisp.js $(MINIFY)
@mkdir -p dist
$(MINIFY) dist/wisp.js > dist/wisp.min.js