summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rubin <87927264+Rexicon226@users.noreply.github.com>2024-06-03 07:46:34 -0700
committerGitHub <noreply@github.com>2024-06-03 14:46:34 +0000
commit4beb52501f863f1cbd92e0ce4879f04f473935b5 (patch)
tree368c6580e84aebdf6b8d081848f2d8deaffca9b1
parent2c50f59f518968643a36e800c0268bcfabc485ac (diff)
downloadwabt-4beb52501f863f1cbd92e0ce4879f04f473935b5.tar.gz
wabt-4beb52501f863f1cbd92e0ce4879f04f473935b5.tar.bz2
wabt-4beb52501f863f1cbd92e0ce4879f04f473935b5.zip
Correct wasm2c example Makefiles (#2426)
- Passing "-lm" into the prereq isn't the correct way add the flag. This correctly adds it to the command. - The "rot13" example incorrectly assumed that the "rot13.h" file would be generated by the time that "main.c" was being compiled, however there is no rule supporting this and it would fail. I've also added "rot13.h" to the clean rule.
-rw-r--r--wasm2c/examples/callback/Makefile3
-rw-r--r--wasm2c/examples/fac/Makefile3
-rw-r--r--wasm2c/examples/fac/fac.wasmbin56 -> 0 bytes
-rw-r--r--wasm2c/examples/rot13/Makefile11
-rw-r--r--wasm2c/examples/threads/Makefile6
5 files changed, 14 insertions, 9 deletions
diff --git a/wasm2c/examples/callback/Makefile b/wasm2c/examples/callback/Makefile
index 81ee53ef..ef7abf76 100644
--- a/wasm2c/examples/callback/Makefile
+++ b/wasm2c/examples/callback/Makefile
@@ -1,12 +1,13 @@
# Use implicit rules for compiling C files.
CFLAGS=-I../..
+LDLIBS=-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 -lm
+callback: main.o callback.o ../../wasm-rt-impl.o ../../wasm-rt-mem-impl.o
callback.wasm: callback.wat ../../../bin/wat2wasm
../../../bin/wat2wasm --debug-names $< -o $@
diff --git a/wasm2c/examples/fac/Makefile b/wasm2c/examples/fac/Makefile
index 623fcfc3..a14a4a6c 100644
--- a/wasm2c/examples/fac/Makefile
+++ b/wasm2c/examples/fac/Makefile
@@ -1,12 +1,13 @@
# Use implicit rules for compiling C files.
CFLAGS=-I../..
+LDLIBS=-lm
all: fac
clean:
rm -rf fac fac.wasm fac.c *.o
-fac: main.o fac.o ../../wasm-rt-impl.o -lm
+fac: main.o fac.o ../../wasm-rt-impl.o
fac.wasm: fac.wat ../../../bin/wat2wasm
../../../bin/wat2wasm $< -o $@
diff --git a/wasm2c/examples/fac/fac.wasm b/wasm2c/examples/fac/fac.wasm
deleted file mode 100644
index 711421b6..00000000
--- a/wasm2c/examples/fac/fac.wasm
+++ /dev/null
Binary files differ
diff --git a/wasm2c/examples/rot13/Makefile b/wasm2c/examples/rot13/Makefile
index 1d46b3a9..ba93d114 100644
--- a/wasm2c/examples/rot13/Makefile
+++ b/wasm2c/examples/rot13/Makefile
@@ -1,17 +1,20 @@
# Use implicit rules for compiling C files.
CFLAGS=-I../..
+LDLIBS=-lm
all: rot13
clean:
- rm -rf rot13 rot13.wasm rot13.c *.o
+ rm -rf rot13 rot13.wasm rot13.c rot13.h *.o
-rot13: main.o rot13.o ../../wasm-rt-impl.o ../../wasm-rt-mem-impl.o -lm
+rot13: main.o rot13.o ../../wasm-rt-impl.o ../../wasm-rt-mem-impl.o
+
+main.o: rot13.h
rot13.wasm: rot13.wat ../../../bin/wat2wasm
../../../bin/wat2wasm $< -o $@
-rot13.c: rot13.wasm ../../../bin/wasm2c
- ../../../bin/wasm2c $< -o $@ --disable-simd
+rot13.c rot13.h: rot13.wasm ../../../bin/wasm2c
+ ../../../bin/wasm2c $< -o rot13.c --disable-simd
.PHONY: all clean
diff --git a/wasm2c/examples/threads/Makefile b/wasm2c/examples/threads/Makefile
index f6eb9998..b671e482 100644
--- a/wasm2c/examples/threads/Makefile
+++ b/wasm2c/examples/threads/Makefile
@@ -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
+LDLIBS=${SANITIZERS} -pthread -lm
all: threads
-threads: threads.o sample.o ../../wasm-rt-impl.o ../../wasm-rt-exceptions-impl.o -lm
-
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
+
sample.wasm: sample.wat ../../../bin/wat2wasm
../../../bin/wat2wasm --debug-names $< -o $@