forked from JohnEarnest/Decker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·95 lines (80 loc) · 2.84 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
VERSION=$(shell cat VERSION)
UNAME=$(shell uname)
SDL=$(shell sdl2-config --cflags --libs)
ifeq ($(UNAME),Darwin)
OPEN=open
COMPILER=clang
FLAGS=-Wall -Werror -Wextra -Wpedantic -Os
# -Wno-misleading-indentation silences warnings which are entirely spurious.
FLAGS:=$(FLAGS) -Wno-misleading-indentation -Wno-unknown-warning-option
# FLAGS:=$(FLAGS) -fsanitize=undefined
# FLAGS:=$(FLAGS) -fsanitize=address
endif
ifeq ($(UNAME),Linux)
OPEN=xdg-open
COMPILER=gcc
# _BSD_SOURCE is required by older versions of GCC to find various posix extensions like realpath().
# _DEFAULT_SOURCE is the same deal, except newer versions of GCC need it
# _POSIX_C_SOURCE is also needed by bestline on older versions of GCC
# -lm is required for math.h
FLAGS=-std=c99 -D _BSD_SOURCE -D _DEFAULT_SOURCE -D _POSIX_C_SOURCE -lm -Wall -Wextra -O2
# -Wno-misleading-indentation silences warnings which are entirely spurious.
# -Wno-format-truncation likewise silences spurious warnings regarding snprintf() truncation.
FLAGS:=$(FLAGS) -Wno-misleading-indentation -Wno-format-truncation
endif
ifneq ("$(wildcard /usr/bin/olpc-hwinfo)","")
# building on an OLPC, disable some features and enable some performance boosts.
FLAGS:=$(FLAGS) -DLOSPEC
else
SDL:=$(SDL) -lSDL2_image
endif
resources:
@chmod +x ./scripts/resources.sh
@./scripts/resources.sh examples/decks/tour.deck
lilt: resources
@mkdir -p c/build
@$(COMPILER) ./c/lilt.c -o ./c/build/lilt $(FLAGS) -DVERSION="\"$(VERSION)\""
decker: resources
@mkdir -p c/build
@$(COMPILER) ./c/decker.c -o ./c/build/decker $(SDL) $(FLAGS) -DVERSION="\"$(VERSION)\""
clean:
@rm -rf ./c/build/
@rm -rf ./js/build/
@rm -f docs/*.html
install:
@chmod +x ./scripts/install.sh
@./scripts/install.sh
uninstall:
@chmod +x ./scripts/uninstall.sh
@./scripts/uninstall.sh
test: lilt
@chmod +x ./scripts/test_interpreter.sh
@./scripts/test_interpreter.sh "./c/build/lilt "
@./c/build/lilt tests/dom/domtests.lil
@./c/build/lilt tests/dom/test_roundtrip.lil
run: lilt
@./c/build/lilt
rundecker: decker
./c/build/decker
.PHONY: jsres
js: jsres
@mkdir -p js/build/
@echo "VERSION=\"${VERSION}\"" > js/build/lilt.js
@cat js/lil.js js/repl.js >> js/build/lilt.js
testjs: js
@chmod +x ./scripts/test_interpreter.sh
@./scripts/test_interpreter.sh "node js/build/lilt.js"
@node js/build/lilt.js tests/dom/domtests.lil
@node js/build/lilt.js tests/dom/test_roundtrip.lil
web-decker: js
@chmod +x ./scripts/web_decker.sh
@./scripts/web_decker.sh examples/decks/tour.deck js/build/decker.html $(VERSION)
runweb: web-decker
$(OPEN) js/build/decker.html
.PHONY: docs
docs:
@multimarkdown docs/lil.md > docs/lil.html
@multimarkdown docs/lilt.md > docs/lilt.html
@multimarkdown docs/decker.md > docs/decker.html
@multimarkdown docs/format.md > docs/format.html
@multimarkdown docs/lilquickref.md > docs/lilquickref.html