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 <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi 2023-11-24 11:42:58 +08:00 committed by Xiang Xiao
parent 3c624d38cd
commit f57cd2cf0c
2 changed files with 11 additions and 8 deletions

View File

@ -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) \
) \
) \
) \

View File

@ -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 $@