-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
33 lines (27 loc) · 786 Bytes
/
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
# Patches welcome to actually make this portable
default: asmjs2wasm
OBJS := main.o parser.o emitter.o wasm_ast.o cashew/parser.o
CFLAGS += -g -std=c++11 -Wall -pedantic
SRCDIR := src
OBJDIR := obj
OBJFILES := $(addprefix $(OBJDIR)/, $(OBJS))
$(OBJDIR):
mkdir $(OBJDIR)
$(OBJDIR)/cashew:
mkdir -p $(OBJDIR)/cashew
$(OBJFILES): | $(OBJDIR) $(OBJDIR)/cashew
$(OBJDIR)/%.o : $(SRCDIR)/%.cpp
c++ -c $(CFLAGS) $< -o $@
asmjs2wasm: $(OBJFILES)
c++ -g $(OBJFILES) -o asmjs2wasm
.PHONY: test
test: asmjs2wasm
for testjs in test/*.js; do \
test=$${testjs%.js}; \
(cat $$testjs | asmjs2wasm | diff - $$test.wasm || \
(echo "Failure running: cat $$testjs | asmjs2wasm | diff - $$test.wasm" && false)) \
done
.PHONY: clean
clean:
rm -f asmjs2wasm
rm -rf $(OBJDIR)