summaryrefslogtreecommitdiff
path: root/web/Makefile
blob: 5fd3a24a81588f91a29533cf21f4c04885254428 (plain) (blame)
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
CC := emcc

CFLAGS += -O3 -Wall -Wextra -I../ \
	-sNO_EXIT_RUNTIME=1 \
	-sENVIRONMENT=web \
	-sEXPORTED_FUNCTIONS=_main,_malloc,_free \
	-sEXPORTED_RUNTIME_METHODS=UTF8ToString,stringToUTF8,lengthBytesUTF8

TARGET := dartboat_web

SRC := $(wildcard *.c) ../comp.c ../match.c ../board.c ../checkouts.c

all: $(TARGET)

debug: CFLAGS := $(filter-out -O3,$(CFLAGS)) \
	-fsanitize=address,undefined \
	-gsource-map \
	-sALLOW_MEMORY_GROWTH=1 \
	-sASSERTIONS=2
comma := ,
debug: CFLAGS := $(patsubst -sEXPORTED_FUNCTIONS=%,-sEXPORTED_FUNCTIONS=$\
	%$(comma)___lsan_do_recoverable_leak_check,$(CFLAGS))
debug: $(TARGET)

$(TARGET): $(SRC)
	mkdir $(TARGET)
	$(CC) $(CFLAGS) $^ -o $(TARGET)/dartboat_wasm.js
	cp -r static/* $(TARGET)/

clean:
	rm -rf $(TARGET)

.PHONY: all clean