This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 3d5183f404d46d4dc00b6ff0ddcefcf2e83bea3d
Author: Huang Qi <[email protected]>
AuthorDate: Mon Jul 17 12:06:13 2023 +0800

    tools: Merge WASM_BUILD and WASM_BUILD_ONLY
    
    By make WASM_BUILD as a three state variable: y , n or both.
    
    Signed-off-by: Huang Qi <[email protected]>
---
 Application.mk | 17 ++++-------------
 tools/Wasm.mk  | 13 +++++++++++--
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/Application.mk b/Application.mk
index adb123f8c..315ac5810 100644
--- a/Application.mk
+++ b/Application.mk
@@ -18,6 +18,9 @@
 #
 ############################################################################
 
+# Include Wasm specific definitions
+include $(APPDIR)/tools/Wasm.mk
+
 # If this is an executable program (with MAINSRC), we must build it as a
 # loadable module for the KERNEL build (always) or if the tristate module
 # has the value "m"
@@ -95,17 +98,15 @@ endif
 
 # Condition flags
 
-DO_REGISTRATION = y
+DO_REGISTRATION ?= y
 
 ifeq ($(PROGNAME),)
   DO_REGISTRATION = n
 endif
 
 ifeq ($(WASM_BUILD),y)
-ifeq ($(WASM_BUILD_ONLY),y)
   DO_REGISTRATION = n
 endif
-endif
 
 # Compile flags, notice the default flags only suitable for flat build
 
@@ -284,13 +285,3 @@ distclean:: clean
        $(call DELFILE, .depend)
 
 -include Make.dep
-
-# Default values for WASM_BUILD from Application.mk
-
-WASM_BUILD ?= n
-
-ifeq ($(WASM_BUILD),y)
-       ifneq 
($(CONFIG_INTERPRETERS_WAMR)$(CONFIG_INTERPRETERS_WASM)$(CONFIG_INTERPRETERS_TOYWASM),)
-               include $(APPDIR)/tools/Wasm.mk
-       endif
-endif
diff --git a/tools/Wasm.mk b/tools/Wasm.mk
index 7b8fe6a98..6f146765e 100644
--- a/tools/Wasm.mk
+++ b/tools/Wasm.mk
@@ -19,6 +19,9 @@
 #
 ############################################################################
 
+# Only build wasm if one of the following runtime is enabled
+
+ifneq 
($(CONFIG_INTERPRETERS_WAMR)$(CONFIG_INTERPRETERS_WASM)$(CONFIG_INTERPRETERS_TOYWASM),)
 include $(APPDIR)$(DELIM)interpreters$(DELIM)wamr$(DELIM)Toolchain.defs
 
 # wasi-sdk toolchain setting
@@ -87,9 +90,14 @@ endef
 
 endif # WASM_BUILD
 
-# If called from Application.mk, WASM_BUILD is defined (y or n)
+# Default values for WASM_BUILD, it's a three state variable:
+#   y - build wasm module only
+#   n - don't build wasm module
+#   both - build wasm module and native module
+
+WASM_BUILD ?= n
 
-ifeq ($(WASM_BUILD),y)
+ifneq ($(WASM_BUILD),n)
 
 WASM_INITIAL_MEMORY ?= 65536
 STACKSIZE           ?= $(CONFIG_DEFAULT_TASK_STACKSIZE)
@@ -134,3 +142,4 @@ clean::
 endif # WASM_BUILD
 
 endif # WCC
+endif

Reply via email to