blob: a7f3f8583552eb04142742aac4ac55f4db7210e9 (
plain) (
blame)
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
|
# Look for wasi-sysroot in some common places, falling back
# to provided WASI_SYSROOT
ifneq ("$(wildcard /usr/wasm32-wasi)", "")
# Fedora
WASI_SYSROOT ?= /usr/wasm32-wasi
else ifneq ("$(wildcard /usr/local/share/wasi-sysroot)", "")
# FreeBSD
WASI_SYSROOT ?= /usr/local/share/wasi-sysroot
endif
export WASI_SYSROOT
CC = clang
CFLAGS = -Wall -Wextra --target=wasm32-wasi --sysroot=$(WASI_SYSROOT)
LDFLAGS = -Wl,--no-entry -mexec-model=reactor --rtlib=compiler-rt
all: hello_world.wasm
bindgen:
/home/andrew/src/c/wasm/wit-bindgen-v0.13.0-x86_64-linux/wit-bindgen c ../wit
hello_world.wasm: bindgen my-component.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ hello_world.c hello_world_component_type.o my-component.c
/home/andrew/src/c/wasm/wasm-tools-1.0.48-x86_64-linux/wasm-tools component new hello_world.wasm -o hello_world-component.wasm
clean:
rm -f hello_world*
|