Skip to content

Commit 606ec5b

Browse files
committedFeb 19, 2025·
fix: restore configuration through env variables
My recent changes had removed the ability to configure what options where used to build through environment variables. This PR restores those environment variables so they can be used as before. Signed-off-by: Michael Dawson <[email protected]>
1 parent 1c7fe8b commit 606ec5b

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed
 

‎build/Makefile

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
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+
114
lib/lexer.wasm: include-wasm/cjs-module-lexer.h src/lexer.c
215
@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)
819

920
optimize: lib/lexer.wasm
1021
${WASM_OPT} -Oz lib/lexer.wasm -o lib/lexer.wasm

0 commit comments

Comments
 (0)
Please sign in to comment.