From f57cd2cf0c682d0a34475173e5edaad38ab013d3 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Fri, 24 Nov 2023 11:42:58 +0800 Subject: [PATCH] tools: Move final wasm module to bin/wasm as elf And leave all intermediate file in apps/wasm, such as .map file, entry object etc used in wasm module build. Signed-off-by: Huang Qi --- interpreters/wamr/Toolchain.defs | 12 ++++++------ tools/Wasm.mk | 7 +++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/interpreters/wamr/Toolchain.defs b/interpreters/wamr/Toolchain.defs index 22185efe6..98a848618 100644 --- a/interpreters/wamr/Toolchain.defs +++ b/interpreters/wamr/Toolchain.defs @@ -74,14 +74,14 @@ define WAMR_AOT_COMPILE $(eval WAMRMODE=$(shell echo $(notdir $(bin)) | cut -d'#' -f5)) \ $(if $(CONFIG_INTERPRETERS_WAMR_AOT), \ $(if $(filter AOT,$(WAMRMODE)), \ - $(info Wamrc Generate AoT: $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).aot) \ - $(shell $(WRC) $(RCFLAGS) -o $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).aot \ - $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm > /dev/null), \ + $(info Wamrc Generate AoT: $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).aot) \ + $(shell $(WRC) $(RCFLAGS) -o $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).aot \ + $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm > /dev/null), \ $(if $(filter XIP,$(WAMRMODE)), \ - $(info Wamrc Generate XiP: $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).xip) \ + $(info Wamrc Generate XiP: $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).xip) \ $(shell $(WRC) $(RCFLAGS) --enable-indirect-mode --disable-llvm-intrinsics \ - -o $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).xip \ - $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm > /dev/null) \ + -o $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).xip \ + $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm > /dev/null) \ ) \ ) \ ) \ diff --git a/tools/Wasm.mk b/tools/Wasm.mk index ed0fe0bbb..99e93f33c 100644 --- a/tools/Wasm.mk +++ b/tools/Wasm.mk @@ -39,7 +39,7 @@ define LINK_WASM $(eval WLDFLAGS=$(shell cat $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).ldflags)) \ $(eval RETVAL=$(shell $(WCC) $(bin) $(WBIN) $(WCFLAGS) $(WLDFLAGS) $(WCC_COMPILER_RT_LIB) \ -Wl,--Map=$(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).map \ - -o $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm || echo 1;)) \ + -o $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm || echo 1;)) \ $(if $(RETVAL), \ $(error wasm build failed for $(PROGNAME).wasm) \ ) \ @@ -86,7 +86,10 @@ endif all:: $(WBIN) -depend:: $(APPDIR)$(DELIM)include$(DELIM)wasm$(DELIM)math.h +$(BINDIR)/wasm: + $(Q) mkdir -p $(BINDIR)/wasm + +depend:: $(APPDIR)$(DELIM)include$(DELIM)wasm$(DELIM)math.h $(BINDIR)/wasm $(WOBJS): %.c$(SUFFIX).wo : %.c $(Q) $(WCC) $(WCFLAGS) -c $^ -o $@