-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (43 loc) · 1.35 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
SHELL := /bin/sh -e
MAKEFLAGS += -B
CC = clang
CFLAGS = -std=c17 -Wall -Wextra -I$(EXTERNALDIR) -g
LDFLAGS =
SRC = src/main.c
OUTDIR = out
OUT = $(OUTDIR)/lilac
EXTERNALDIR = external
TEST_SRC = tests/test_runner.c
TEST_OUT = $(OUTDIR)/test_runner
WASM_OUT = out/lilac.js
WASM_FLAGS = -s WASM=1 -s EXPORTED_RUNTIME_METHODS='["cwrap"]' -s INVOKE_RUN=0
$(shell mkdir -p $(OUTDIR) $(EXTERNALDIR))
all: $(OUT)
$(OUT): $(SRC)
$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
test: $(TEST_OUT)
$(TEST_OUT): $(TEST_SRC)
$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
wasm: $(WASM_OUT)
$(WASM_OUT): $(SRC)
emcc $(CFLAGS) $(WASM_FLAGS) $< -o $@ $(LDFLAGS)
cp -f site/index.html out/index.html
compile-db:
bear -- make all
stb:
curl -L -o $(EXTERNALDIR)/stb_ds.h https://raw.githubusercontent.com/nothings/stb/1ee679ca2ef753a528db5ba6801e1067b40481b8/stb_ds.h
greatest:
curl -L -o $(EXTERNALDIR)/greatest.h https://raw.githubusercontent.com/silentbicycle/greatest/fbbf9818ec72578289716bf6002b11fd25185e02/greatest.h
gb:
curl -L -o $(EXTERNALDIR)/gb_string.h https://raw.githubusercontent.com/gingerBill/gb/fd88428545cac94db72e93a1ff36c27153628874/gb_string.h
deps: greatest stb gb
prod:
./scripts/setup_llvm.sh
./scripts/setup_emsdk.sh
make deps
clean:
rm -rf $(OUTDIR)/*
distclean:
rm -rf $(OUTDIR)/*
rm -rf $(EXTERNALDIR)/*
.PHONY: all clean deps greatest distclean compile-db test