-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
executable file
·48 lines (41 loc) · 937 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
DEPS =
OBJ = library.o
NANOLIBC_OBJ = $(patsubst %.cpp,%.o,$(wildcard nanolibc/*.cpp))
OUTPUT = library.wasm
COMPILE_FLAGS = -Wall \
--target=wasm32 \
-Os \
-nostdlib \
-fvisibility=hidden \
-std=c++14 \
-ffunction-sections \
-fdata-sections \
-DPRINTF_DISABLE_SUPPORT_FLOAT=1 \
-DPRINTF_DISABLE_SUPPORT_LONG_LONG=1 \
-DPRINTF_DISABLE_SUPPORT_PTRDIFF_T=1
$(OUTPUT): $(OBJ) $(NANOLIBC_OBJ) Makefile
wasm-ld \
-o $(OUTPUT) \
--no-entry \
--strip-all \
--export-dynamic \
--allow-undefined \
--initial-memory=131072 \
-error-limit=0 \
--lto-O3 \
-O3 \
--gc-sections \
$(OBJ) \
$(LIBCXX_OBJ) \
$(NANOLIBC_OBJ)
%.o: %.cpp $(DEPS) Makefile nanolibc/libc.h nanolibc/libc_extra.h
clang++ \
-c \
$(COMPILE_FLAGS) \
-o $@ \
$<
library.wat: $(OUTPUT) Makefile
~/build/wabt/wasm2wat -o library.wat $(OUTPUT)
wat: library.wat
clean:
rm -f $(OBJ) $(NANOLIBC_OBJ) $(OUTPUT) library.wat