File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11CC = clang
22
3- CFLAGS = --target=wasm32 -nostdlib -O2 \
4- -ffunction-sections -fdata-sections \
5- -mbulk-memory \
6- -DCLAY_IMPLEMENTATION -DCLAY_WASM \
7- -Isrc -I.
3+ CFLAGS_BASE = --target=wasm32 -nostdlib \
4+ -ffunction-sections -fdata-sections \
5+ -mbulk-memory \
6+ -Isrc -I.
7+
8+ INPUT_OPT ?= -Oz
9+ LAYOUT_OPT ?= -O2
10+
11+ LAYOUT_CFLAGS = $(CFLAGS_BASE ) $(LAYOUT_OPT ) -DCLAY_IMPLEMENTATION -DCLAY_WASM
12+ INPUT_CFLAGS = $(CFLAGS_BASE ) $(INPUT_OPT )
813
914LDFLAGS_COMMON = -Wl,--no-entry \
1015 -Wl,--import-memory \
@@ -54,10 +59,10 @@ all: layout.wasm input.wasm layout.wasm.ts input.wasm.ts
5459 @echo " Built input.wasm ($$ (wc -c < input.wasm) bytes raw, $$ (gzip -c input.wasm | wc -c) bytes gzip)"
5560
5661layout.wasm : $(DEPS )
57- $(CC ) $(CFLAGS ) $(LAYOUT_LDFLAGS ) -o $@ src/module-layout.c
62+ $(CC ) $(LAYOUT_CFLAGS ) $(LAYOUT_LDFLAGS ) -o $@ src/module-layout.c
5863
5964input.wasm : $(DEPS )
60- $(CC ) $(filter-out -DCLAY_IMPLEMENTATION -DCLAY_WASM, $( CFLAGS ) ) $(INPUT_LDFLAGS ) -o $@ src/module-input.c
65+ $(CC ) $(INPUT_CFLAGS ) $(INPUT_LDFLAGS ) -o $@ src/module-input.c
6166
6267layout.wasm.ts : layout.wasm
6368 deno run --allow-read --allow-write tasks/bundle-wasm.ts layout.wasm layout.wasm.ts
You can’t perform that action at this time.
0 commit comments