|
| 1 | +# These flags depend on the system and may be overridden |
| 2 | +WASM_CC := clang |
| 3 | +WASM_CFLAGS := --sysroot=/usr/share/wasi-sysroot |
| 4 | +WASM_LDFLAGS := -nostartfiles |
| 5 | + |
| 6 | +# These are project-specific and are expected to be kept intact |
| 7 | +WASM_TARGET := -target wasm32-unknown-wasi |
| 8 | +WASM_EXTRA_CFLAGS := -I include-wasm/ -Wno-logical-op-parentheses -Wno-parentheses -Oz |
| 9 | +WASM_EXTRA_LDFLAGS := -Wl,-z,stack-size=13312,--no-entry,--compress-relocations,--strip-all |
| 10 | +WASM_EXTRA_LDFLAGS += -Wl,--export=__heap_base,--export=parseCJS,--export=sa |
| 11 | +WASM_EXTRA_LDFLAGS += -Wl,--export=e,--export=re,--export=es,--export=ee |
| 12 | +WASM_EXTRA_LDFLAGS += -Wl,--export=rre,--export=ree,--export=res,--export=ru,--export=us,--export=ue |
| 13 | + |
1 | 14 | lib/lexer.wasm: include-wasm/cjs-module-lexer.h src/lexer.c
|
2 | 15 | @mkdir -p lib
|
3 |
| - clang --sysroot=/usr/share/wasi-sysroot -target wasm32-unknown-wasi src/lexer.c -I include-wasm -o lib/lexer.wasm -nostartfiles \ |
4 |
| - -Wl,-z,stack-size=13312,--no-entry,--compress-relocations,--strip-all,--export=__heap_base,\ |
5 |
| - --export=parseCJS,--export=sa,--export=e,--export=re,--export=es,--export=ee,--export=rre,--export=ree,--export=res,--export=ru,--export=us,--export=ue \ |
6 |
| - -Wno-logical-op-parentheses -Wno-parentheses \ |
7 |
| - -Oz |
| 16 | + $(WASM_CC) $(WASM_CFLAGS) $(WASM_TARGET) $(WASM_EXTRA_CFLAGS) \ |
| 17 | + src/lexer.c -o lib/lexer.wasm \ |
| 18 | + $(WASM_LDFLAGS) $(WASM_EXTRA_LDFLAGS) |
8 | 19 |
|
9 | 20 | optimize: lib/lexer.wasm
|
10 | 21 | ${WASM_OPT} -Oz lib/lexer.wasm -o lib/lexer.wasm
|
|
0 commit comments