From da9f07ce054c7af5061279c3d237fd64d63d9f9b Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 9 Mar 2022 07:40:04 +0000 Subject: Improve wasm2c example update process. NFC (#1857) Followup to #1851. --- Makefile | 1 + wasm2c/examples/fac/Makefile | 12 ++++++++++-- wasm2c/examples/rot13/Makefile | 14 +++++++++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 05194a88..7915598b 100644 --- a/Makefile +++ b/Makefile @@ -146,6 +146,7 @@ src/prebuilt/lexer-keywords.cc: src/lexer-keywords.txt .PHONY: update-wasm2c update-wasm2c: src/prebuilt/wasm2c.include.c src/prebuilt/wasm2c.include.h + make -C wasm2c/examples/fac src/prebuilt/wasm2c.include.c: src/wasm2c.c.tmpl src/wasm2c_tmpl.py -o $@ $< diff --git a/wasm2c/examples/fac/Makefile b/wasm2c/examples/fac/Makefile index f5b2a338..caf32e24 100644 --- a/wasm2c/examples/fac/Makefile +++ b/wasm2c/examples/fac/Makefile @@ -1,9 +1,17 @@ # Use implicit rules for compiling C files. CFLAGS=-I../.. + +all: fac + +clean: + rm -rf fac fac.wasm fac.c *.o + fac: main.o fac.o ../../wasm-rt-impl.o -fac.wasm: fac.wat +fac.wasm: fac.wat ../../../bin/wat2wasm ../../../bin/wat2wasm $< -o $@ -fac.c: fac.wasm +fac.c: fac.wasm ../../../bin/wasm2c ../../../bin/wasm2c $< -o $@ + +.PHONY: all clean diff --git a/wasm2c/examples/rot13/Makefile b/wasm2c/examples/rot13/Makefile index 35483310..b58db6be 100644 --- a/wasm2c/examples/rot13/Makefile +++ b/wasm2c/examples/rot13/Makefile @@ -1,9 +1,17 @@ # Use implicit rules for compiling C files. CFLAGS=-I../.. -rot13: main.o rot13.o ../../wasm-rt-impl.o -rot13.wasm: rot13.wat +all: rot13 + +clean: + rm -rf rot13 rot13.wasm rot13.c *.o + +rot13: main.o rot13.o ../../wasm-rt-impl.o ../../wasm-rt-os-unix.o -lm + +rot13.wasm: rot13.wat ../../../bin/wat2wasm ../../../bin/wat2wasm $< -o $@ -rot13.c: rot13.wasm +rot13.c: rot13.wasm ../../../bin/wasm2c ../../../bin/wasm2c $< -o $@ + +.PHONY: all clean -- cgit v1.2.3