Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct wasm2c example Makefiles #2426

Merged
merged 5 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pass "-lm" through "LDFLAGS"
  • Loading branch information
Rexicon226 committed May 21, 2024
commit 34d8b44d78824fc1cab3a654b475c6d5a3755bfc
3 changes: 2 additions & 1 deletion wasm2c/examples/callback/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Use implicit rules for compiling C files.
CFLAGS=-I../..
LDFLAGS=-lm

all: callback

clean:
rm -rf callback callback.wasm callback.c callback.h *.o

callback: main.o callback.o ../../wasm-rt-impl.o ../../wasm-rt-mem-impl.o
$(CC) $(LDFLAGS) -o $@ $^ -lm
$(CC) -o $@ $^ $(LDFLAGS)

callback.wasm: callback.wat ../../../bin/wat2wasm
../../../bin/wat2wasm --debug-names $< -o $@
Expand Down
3 changes: 2 additions & 1 deletion wasm2c/examples/fac/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Use implicit rules for compiling C files.
CFLAGS=-I../..
LDFLAGS=-lm

all: fac

clean:
rm -rf fac fac.wasm fac.c *.o

fac: main.o fac.o ../../wasm-rt-impl.o
$(CC) $(LDFLAGS) -o $@ $^ -lm
$(CC) -o $@ $^ $(LDFLAGS)

fac.wasm: fac.wat ../../../bin/wat2wasm
../../../bin/wat2wasm $< -o $@
Expand Down
3 changes: 2 additions & 1 deletion wasm2c/examples/rot13/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Use implicit rules for compiling C files.
CFLAGS=-I../..
LDFLAGS=-lm

all: rot13

clean:
rm -rf rot13 rot13.wasm rot13.c rot13.h *.o

rot13: main.o rot13.o ../../wasm-rt-impl.o ../../wasm-rt-mem-impl.o
$(CC) $(LDFLAGS) -o $@ $^ -lm
$(CC) -o $@ $^ $(LDFLAGS)

main.o: rot13.h

Expand Down
4 changes: 2 additions & 2 deletions wasm2c/examples/threads/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#SANITIZERS=-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all
CFLAGS=-I../.. -g -O2 -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-array-bounds -Wno-ignored-optimization-argument -Wno-tautological-constant-out-of-range-compare -Wno-infinite-recursion -fno-optimize-sibling-calls -frounding-math -fsignaling-nans ${SANITIZERS} -pthread
LDFLAGS=${SANITIZERS} -pthread
LDFLAGS=${SANITIZERS} -pthread -lm

all: threads

clean:
rm -rf threads sample.wasm sample.c sample.h *.o ../../*.o

threads: threads.o sample.o ../../wasm-rt-impl.o ../../wasm-rt-exceptions-impl.o
$(CC) $(LDFLAGS) -o $@ $^ -lm
$(CC) -o $@ $^ $(LDFLAGS)

sample.wasm: sample.wat ../../../bin/wat2wasm
../../../bin/wat2wasm --debug-names $< -o $@
Expand Down
Loading