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 bebb7e9a467225500c6b23d29f633b2a51b33b31
Author: anjiahao <anjia...@xiaomi.com>
AuthorDate: Fri Mar 22 16:05:18 2024 +0800

    module/sotest:use Compile dynamic modules using a unified compilation method
    
    Signed-off-by: anjiahao <anjia...@xiaomi.com>
---
 examples/module/.gitignore                         |   1 +
 examples/module/Make.defs                          |   4 +-
 examples/module/Makefile                           |  44 +--------
 examples/module/chardev/Kconfig                    |   4 +
 examples/module/{ => chardev}/Make.defs            |   4 +-
 .../{sotest/lib/sotest => module/chardev}/Makefile |  46 +--------
 examples/module/{drivers => }/chardev/chardev.c    |   2 +-
 examples/module/drivers/.gitignore                 |   5 -
 examples/module/drivers/Makefile                   | 110 ---------------------
 examples/module/drivers/chardev/.gitignore         |   1 -
 examples/module/drivers/chardev/Makefile           |  73 --------------
 examples/module/main/.gitignore                    |   5 +
 examples/module/{ => main}/CMakeLists.txt          |   2 +-
 examples/module/{ => main}/Kconfig                 |   0
 examples/module/{ => main}/Make.defs               |   4 +-
 examples/module/main/Makefile                      |  89 +++++++++++++++++
 examples/module/{ => main}/module_main.c           |  10 +-
 examples/sotest/.gitignore                         |   1 +
 examples/sotest/Make.defs                          |   4 +-
 examples/sotest/Makefile                           |  39 +-------
 examples/sotest/lib/.gitignore                     |   4 -
 examples/sotest/lib/Makefile                       |  81 ---------------
 examples/sotest/lib/modprint/.gitignore            |   1 -
 examples/sotest/lib/modprint/Makefile              |  64 ------------
 examples/sotest/lib/sotest/.gitignore              |   1 -
 examples/sotest/main/.gitignore                    |   3 +
 examples/sotest/{ => main}/CMakeLists.txt          |   2 +-
 examples/sotest/{ => main}/Kconfig                 |   0
 examples/sotest/{ => main}/Make.defs               |   4 +-
 examples/sotest/{ => main}/Makefile                |  46 +++++----
 examples/sotest/{ => main}/sotest_main.c           |   2 +-
 examples/sotest/modprint/Kconfig                   |   4 +
 examples/sotest/{ => modprint}/Make.defs           |   4 +-
 examples/sotest/{Make.defs => modprint/Makefile}   |  13 ++-
 examples/sotest/{lib => }/modprint/modprint.c      |   2 +-
 examples/sotest/sotest/Kconfig                     |   4 +
 examples/sotest/{ => sotest}/Make.defs             |   4 +-
 examples/sotest/{Make.defs => sotest/Makefile}     |  13 ++-
 examples/sotest/{lib => }/sotest/sotest.c          |   2 +-
 39 files changed, 190 insertions(+), 512 deletions(-)

diff --git a/examples/module/.gitignore b/examples/module/.gitignore
new file mode 100644
index 000000000..9e1d2593e
--- /dev/null
+++ b/examples/module/.gitignore
@@ -0,0 +1 @@
+/Kconfig
diff --git a/examples/module/Make.defs b/examples/module/Make.defs
index 6729d9c24..57b758ed1 100644
--- a/examples/module/Make.defs
+++ b/examples/module/Make.defs
@@ -18,6 +18,4 @@
 #
 ############################################################################
 
-ifneq ($(CONFIG_EXAMPLES_MODULE),)
-CONFIGURED_APPS += $(APPDIR)/examples/module
-endif
+include $(wildcard $(APPDIR)/examples/module/*/Make.defs)
diff --git a/examples/module/Makefile b/examples/module/Makefile
index 1a3c51356..802434271 100644
--- a/examples/module/Makefile
+++ b/examples/module/Makefile
@@ -18,46 +18,6 @@
 #
 ############################################################################
 
-include $(APPDIR)/Make.defs
+MENUDESC = "Module example"
 
-# Module example built-in application info
-
-PROGNAME = module
-PRIORITY = SCHED_PRIORITY_DEFAULT
-STACKSIZE = $(CONFIG_DEFAULT_TASK_STACKSIZE)
-MODULE = $(CONFIG_EXAMPLES_MODULE)
-
-# Module Example
-
-ifeq ($(CONFIG_EXAMPLES_MODULE_ROMFS),y)
-CSRCS = romfs.c
-endif
-ifeq ($(CONFIG_EXAMPLES_MODULE_CROMFS),y)
-CSRCS = cromfs.c
-endif
-CSRCS += mod_symtab.c
-drivers$(DELIM)mod_symtab.c_CFLAGS = -fno-builtin
-drivers$(DELIM)mod_symtab.c_CELFFLAGS = -fno-builtin
-MAINSRC = module_main.c
-
-VPATH += drivers
-DEPPATH += --dep-path drivers
-
-# Build targets
-
-ifeq ($(CONFIG_EXAMPLES_MODULE_ROMFS),y)
-drivers/romfs.c: build
-endif
-ifeq ($(CONFIG_EXAMPLES_MODULE_CROMFS),y)
-drivers/cromfs.c: build
-endif
-drivers/mod_symtab.c: build
-
-.PHONY: build
-build:
-       +$(Q) $(MAKE) -C drivers TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" 
CROSSDEV=$(CROSSDEV)
-
-clean::
-       +$(Q) $(MAKE) -C drivers TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" 
CROSSDEV=$(CROSSDEV) clean
-
-include $(APPDIR)/Application.mk
+include $(APPDIR)/Directory.mk
diff --git a/examples/module/chardev/Kconfig b/examples/module/chardev/Kconfig
new file mode 100644
index 000000000..f72f3c094
--- /dev/null
+++ b/examples/module/chardev/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
diff --git a/examples/module/Make.defs b/examples/module/chardev/Make.defs
similarity index 91%
copy from examples/module/Make.defs
copy to examples/module/chardev/Make.defs
index 6729d9c24..df35a6034 100644
--- a/examples/module/Make.defs
+++ b/examples/module/chardev/Make.defs
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/examples/module/Make.defs
+# apps/examples/module/chardev/Make.defs
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -19,5 +19,5 @@
 ############################################################################
 
 ifneq ($(CONFIG_EXAMPLES_MODULE),)
-CONFIGURED_APPS += $(APPDIR)/examples/module
+CONFIGURED_APPS += $(APPDIR)/examples/module/chardev
 endif
diff --git a/examples/sotest/lib/sotest/Makefile 
b/examples/module/chardev/Makefile
similarity index 51%
rename from examples/sotest/lib/sotest/Makefile
rename to examples/module/chardev/Makefile
index 55338e1da..070247a01 100644
--- a/examples/sotest/lib/sotest/Makefile
+++ b/examples/module/chardev/Makefile
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/examples/sotest/lib/sotest/Makefile
+# apps/examples/module/chardev/Makefile
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -20,45 +20,9 @@
 
 include $(APPDIR)/Make.defs
 
-ifeq ($(CONFIG_EXAMPLES_SOTEST_LIBGCC),y)
-LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name 2>/dev/null}"
-ifneq ($(LIBGCC),)
-  LDLIBPATH += -L "${shell dirname $(LIBGCC)}"
-  LDLIBS += -lgcc
-endif
-endif
+PROGNAME = chardev
+DYNLIB = y
 
-ifeq ($(CONFIG_EXAMPLES_SOTEST_LIBC),y)
-LDMODULEFLAGS += -Bstatic
-LDLIBPATH +=  -L $(NUTTXLIB)
-endif
+MAINSRC = chardev.c
 
-ifeq ($(CONFIG_EXAMPLES_SOTEST_LIBC),y)
-LDLIBS += -lc
-endif
-
-BIN = sotest
-
-SRCS = $(BIN).c
-OBJS = $(SRCS:.c=$(OBJEXT))
-
-all: $(BIN)
-.PHONY: all clean install
-
-$(OBJS): %$(OBJEXT): %.c
-       @echo "MODULECC: $<"
-       $(Q) $(MODULECC) -c $(CMODULEFLAGS) $< -o $@
-
-$(BIN): $(OBJS)
-       @echo "MODULELD: $<"
-       $(Q) $(MODULELD) $(LDMODULEFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ 
$(LDLIBS)
-
-$(FSROOT_DIR)/$(BIN): $(BIN)
-       $(Q) mkdir -p $(FSROOT_DIR)
-       $(Q) install $(BIN) $(FSROOT_DIR)/$(BIN)
-
-install: $(FSROOT_DIR)/$(BIN)
-
-clean:
-       $(call DELFILE, $(BIN))
-       $(call CLEAN)
+include $(APPDIR)/Application.mk
diff --git a/examples/module/drivers/chardev/chardev.c 
b/examples/module/chardev/chardev.c
similarity index 98%
rename from examples/module/drivers/chardev/chardev.c
rename to examples/module/chardev/chardev.c
index a96f397df..dcc816a60 100644
--- a/examples/module/drivers/chardev/chardev.c
+++ b/examples/module/chardev/chardev.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * apps/examples/module/drivers/chardev/chardev.c
+ * apps/examples/module/chardev/chardev.c
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
diff --git a/examples/module/drivers/.gitignore 
b/examples/module/drivers/.gitignore
deleted file mode 100644
index 922cf8961..000000000
--- a/examples/module/drivers/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/fsroot
-/romfs.c
-/cromfs.c
-/romfs.img
-/mod_symtab.c
diff --git a/examples/module/drivers/Makefile b/examples/module/drivers/Makefile
deleted file mode 100644
index 248067f18..000000000
--- a/examples/module/drivers/Makefile
+++ /dev/null
@@ -1,110 +0,0 @@
-############################################################################
-# apps/examples/module/drivers/Makefile
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-ALL_SUBDIRS = chardev
-BUILD_SUBDIRS = chardev
-FSIMG_SUBDIR = fsroot
-
-MODULE_DIR = $(APPDIR)/examples/module
-DRIVER_DIR = $(MODULE_DIR)/drivers
-FSROOT_DIR = $(DRIVER_DIR)/fsroot
-SYMTAB_SRC = $(DRIVER_DIR)/mod_symtab.c
-
-ifneq ($(CONFIG_BUILD_FLAT),y)
-  PASS1_SYMTAB = $(TOPDIR)/pass1/mod_symtab.c
-endif
-
-ifeq ($(CONFIG_EXAMPLES_MODULE_BUILTINFS),y)
-ifeq ($(CONFIG_EXAMPLES_MODULE_ROMFS),y)
-  ROMFS_IMG = $(DRIVER_DIR)/romfs.img
-  FSIMG_SRC = $(DRIVER_DIR)/romfs.c
-else ifeq ($(CONFIG_EXAMPLES_MODULE_CROMFS),y)
-  NXTOOLDIR = $(TOPDIR)/tools
-  GENCROMFSSRC = gencromfs.c
-  GENCROMFSEXE = gencromfs$(HOSTEXEEXT)
-
-  FSIMG_SRC = $(DRIVER_DIR)/cromfs.c
-endif
-endif
-
-define DIR_template
-$(1)_$(2):
-       +$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" 
FSROOT_DIR="$(FSROOT_DIR)" CROSSDEV=$(CROSSDEV)
-endef
-
-all: $(FSIMG_SRC) $(SYMTAB_SRC) $(PASS1_SYMTAB)
-.PHONY: all clean install
-
-$(foreach DIR, $(ALL_SUBDIRS), $(eval $(call DIR_template,$(DIR),clean)))
-$(foreach DIR, $(BUILD_SUBDIRS), $(eval $(call DIR_template,$(DIR),install)))
-
-# Install each program in the fsroot directory
-
-install: $(foreach DIR, $(BUILD_SUBDIRS), $(DIR)_install)
-
-ifeq ($(CONFIG_EXAMPLES_MODULE_BUILTINFS),y)
-ifeq ($(CONFIG_EXAMPLES_MODULE_ROMFS),y)
-# Create the romfs.img file from the populated fsroot directory
-
-$(ROMFS_IMG): install
-       $(Q) genromfs -f $@.tmp -d $(FSROOT_DIR) -V "MODULETEST"
-       $(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
-
-# Create the romfs.c file from the romfs.img file
-
-$(FSIMG_SRC): $(ROMFS_IMG)
-       $(Q) (cd $(DRIVER_DIR) && echo "#include <nuttx/compiler.h>" >$@ && \
-               xxd -i romfs.img | sed -e "s/^unsigned char/const unsigned char 
aligned_data(4)/g" >>$@)
-
-else ifeq ($(CONFIG_EXAMPLES_MODULE_CROMFS),y)
-# Make sure that the NuttX gencromfs tool has been built
-
-$(NXTOOLDIR)/$(GENCROMFSEXE): $(NXTOOLDIR)/$(GENCROMFSSRC)
-       $(Q) $(MAKE) -C $(NXTOOLDIR) -f Makefile.host $(GENCROMFSEXE)
-
-# Create the cromfs.c file from the populated cromfs directory
-
-$(FSIMG_SRC): install $(NXTOOLDIR)/$(GENCROMFSEXE)
-       $(Q) $(NXTOOLDIR)/$(GENCROMFSEXE) $(FSIMG_DIR) $@.tmp
-       $(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
-
-endif
-endif
-
-# Create the exported symbol table
-
-$(SYMTAB_SRC): install
-       $(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(FSROOT_DIR) g_mod 
>$@.tmp
-       $(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
-
-# Copy the symbol table into the kernel pass1/ build directory
-
-ifneq ($(CONFIG_BUILD_FLAT),y)
-$(PASS1_SYMTAB): $(SYMTAB_SRC)
-       $(Q) install -m 0644 $(SYMTAB_SRC) $(PASS1_SYMTAB)
-endif
-
-# Clean each subdirectory
-
-clean: $(foreach DIR, $(ALL_SUBDIRS), $(DIR)_clean)
-       $(Q) rm -f $(FSIMG_SRC) $(ROMFS_IMG) $(SYMTAB_SRC)
-       $(Q) rm -rf $(FSROOT_DIR)
diff --git a/examples/module/drivers/chardev/.gitignore 
b/examples/module/drivers/chardev/.gitignore
deleted file mode 100644
index c28dc954f..000000000
--- a/examples/module/drivers/chardev/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/chardev
diff --git a/examples/module/drivers/chardev/Makefile 
b/examples/module/drivers/chardev/Makefile
deleted file mode 100644
index abf530f58..000000000
--- a/examples/module/drivers/chardev/Makefile
+++ /dev/null
@@ -1,73 +0,0 @@
-############################################################################
-# apps/examples/module/drivers/chardev/Makefile
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-CMODULEFLAGS += $(KDEFINE)
-
-ifeq ($(CONFIG_EXAMPLES_MODULE_LIBGCC),y)
-LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name 2>/dev/null}"
-ifneq ($(LIBGCC),)
-  LDLIBPATH += -L "${shell dirname $(LIBGCC)}"
-  LDLIBS += -lgcc
-endif
-endif
-
-ifeq ($(CONFIG_EXAMPLES_MODULE_LIBC),y)
-LDMODULEFLAGS += -Bstatic
-LDLIBPATH +=  -L $(NUTTXLIB)
-endif
-
-ifeq ($(CONFIG_EXAMPLES_MODULE_LIBC),y)
-ifneq ($(CONFIG_BUILD_FLAT),y)
-LDLIBS += -lkc
-else
-LDLIBS += -lc
-endif
-endif
-
-BIN = chardev
-
-SRCS = $(BIN).c
-OBJS = $(SRCS:.c=$(OBJEXT))
-
-all: $(BIN)
-.PHONY: all clean install
-
-$(OBJS): %$(OBJEXT): %.c
-       @echo "MODULECC: $<"
-       $(Q) $(MODULECC) -c $(CMODULEFLAGS) $< -o $@
-
-$(BIN): $(OBJS)
-       @echo "MODULELD: $<"
-       $(Q) $(MODULELD) $(LDMODULEFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ 
$(LDLIBS)
-
-$(FSROOT_DIR)/$(BIN): $(BIN)
-       $(Q) mkdir -p $(FSROOT_DIR)
-       $(Q) install $(BIN) $(FSROOT_DIR)/$(BIN)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(MODULESTRIP) $(FSROOT_DIR)/$(BIN)
-endif
-
-install: $(FSROOT_DIR)/$(BIN)
-
-clean:
-       $(call DELFILE, $(BIN))
-       $(call CLEAN)
diff --git a/examples/module/main/.gitignore b/examples/module/main/.gitignore
new file mode 100644
index 000000000..03d6e064e
--- /dev/null
+++ b/examples/module/main/.gitignore
@@ -0,0 +1,5 @@
+/chardev_romfs.c
+/chardev_romfs.img
+/cromfs.c
+/chardev_mod_symtab.c
+/mod_symtab.c
diff --git a/examples/module/CMakeLists.txt 
b/examples/module/main/CMakeLists.txt
similarity index 95%
rename from examples/module/CMakeLists.txt
rename to examples/module/main/CMakeLists.txt
index 0b6a68e82..57f3f4f01 100644
--- a/examples/module/CMakeLists.txt
+++ b/examples/module/main/CMakeLists.txt
@@ -1,5 +1,5 @@
 # 
##############################################################################
-# apps/examples/module/CMakeLists.txt
+# apps/examples/module/main/CMakeLists.txt
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more 
contributor
 # license agreements.  See the NOTICE file distributed with this work for
diff --git a/examples/module/Kconfig b/examples/module/main/Kconfig
similarity index 100%
rename from examples/module/Kconfig
rename to examples/module/main/Kconfig
diff --git a/examples/module/Make.defs b/examples/module/main/Make.defs
similarity index 91%
copy from examples/module/Make.defs
copy to examples/module/main/Make.defs
index 6729d9c24..f4f4ea83c 100644
--- a/examples/module/Make.defs
+++ b/examples/module/main/Make.defs
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/examples/module/Make.defs
+# apps/examples/module/main/Make.defs
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -19,5 +19,5 @@
 ############################################################################
 
 ifneq ($(CONFIG_EXAMPLES_MODULE),)
-CONFIGURED_APPS += $(APPDIR)/examples/module
+CONFIGURED_APPS += $(APPDIR)/examples/module/main
 endif
diff --git a/examples/module/main/Makefile b/examples/module/main/Makefile
new file mode 100644
index 000000000..c731bade5
--- /dev/null
+++ b/examples/module/main/Makefile
@@ -0,0 +1,89 @@
+############################################################################
+# apps/examples/module/main/Makefile
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at 
http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+include $(APPDIR)/Make.defs
+
+# Module example built-in application info
+
+PROGNAME = module
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = $(CONFIG_DEFAULT_TASK_STACKSIZE)
+MODULE = $(CONFIG_EXAMPLES_MODULE)
+
+MAINSRC = module_main.c
+
+SYMTABSRC = mod_symtab.c
+SYMTABOBJ = $(SYMTABSRC:.c=$(OBJEXT))
+
+$(SYMTABSRC):
+       $(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(BINDIR) g_mod >$@.tmp
+       $(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
+
+
+$(SYMTABOBJ): %$(OBJEXT): %.c
+       $(call COMPILE, $<, $@, -fno-lto -fno-builtin)
+
+ifeq ($(CONFIG_EXAMPLES_MODULE_BUILTINFS),y)
+ifeq ($(CONFIG_EXAMPLES_MODULE_ROMFS),y)
+
+ROMFSIMG = chardev_romfs.img
+ROMFSSRC = chardev_romfs.c
+ROMFSOBJ = $(ROMFSSRC:.c=$(OBJEXT))
+
+$(ROMFSIMG):
+       $(Q) genromfs -d $(BINDIR) -f $@
+
+$(ROMFSSRC): $(ROMFSIMG)
+       $(Q) (echo "#include <nuttx/compiler.h>" >$@ && \
+               xxd -i $(ROMFSIMG) | sed -e "s/^unsigned char/const unsigned 
char aligned_data(4)/g" >>$@)
+
+$(ROMFSOBJ): %$(OBJEXT): %.c
+       $(call COMPILE, $<, $@, -fno-lto -fno-builtin)
+
+else ifeq ($(CONFIG_EXAMPLES_MODULE_CROMFS),y)
+  NXTOOLDIR = $(TOPDIR)/tools
+  GENCROMFSSRC = gencromfs.c
+  GENCROMFSEXE = gencromfs$(HOSTEXEEXT)
+
+  FSIMG_SRC = cromfs.c
+       FSIMG_OBJ = $(FSIMG_SRC:.c=$(OBJEXT))
+
+$(NXTOOLDIR)/$(GENCROMFSEXE): $(NXTOOLDIR)/$(GENCROMFSSRC)
+       $(Q) $(MAKE) -C $(NXTOOLDIR) -f Makefile.host $(GENCROMFSEXE)
+
+# Create the cromfs.c file from the populated cromfs directory
+
+$(FSIMG_SRC):$(NXTOOLDIR)/$(GENCROMFSEXE)
+       $(Q) $(NXTOOLDIR)/$(GENCROMFSEXE) $(BINDIR) $@.tmp
+       $(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
+
+$(FSIMG_OBJ): %$(OBJEXT): %.c
+       $(call COMPILE, $<, $@, -fno-lto -fno-builtin)
+
+endif
+
+endif
+
+postinstall:: $(ROMFSOBJ) $(SYMTABOBJ) $(FSIMG_OBJ)
+       $(call ARLOCK, $(call CONVERT_PATH,$(BIN)), $^)
+
+distclean::
+       $(Q) $(call DELFILE, $(SYMTABSRC) $(SYMTABOBJ) $(ROMFSSRC) $(ROMFSIMG) 
$(ROMFSOBJ))
+
+
+include $(APPDIR)/Application.mk
diff --git a/examples/module/module_main.c b/examples/module/main/module_main.c
similarity index 97%
rename from examples/module/module_main.c
rename to examples/module/main/module_main.c
index 3c72f5aa3..903aced65 100644
--- a/examples/module/module_main.c
+++ b/examples/module/main/module_main.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * apps/examples/module/module_main.c
+ * apps/examples/module/main/module_main.c
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -114,8 +114,8 @@ static const char g_write_string[] = "Hi there installed 
driver\n";
  ****************************************************************************/
 
 #if defined(CONFIG_EXAMPLES_MODULE_ROMFS) || 
defined(CONFIG_EXAMPLES_MODULE_CROMFS)
-extern const unsigned char romfs_img[];
-extern const unsigned int romfs_img_len;
+extern const unsigned char chardev_romfs_img[];
+extern const unsigned int chardev_romfs_img_len;
 #endif
 
 #ifdef CONFIG_BUILD_FLAT
@@ -172,9 +172,9 @@ int main(int argc, FAR char *argv[])
          CONFIG_EXAMPLES_MODULE_DEVMINOR);
 
   desc.minor    = CONFIG_EXAMPLES_MODULE_DEVMINOR;      /* Minor device number 
of the ROM disk. */
-  desc.nsectors = NSECTORS(romfs_img_len);              /* The number of 
sectors in the ROM disk */
+  desc.nsectors = NSECTORS(chardev_romfs_img_len);      /* The number of 
sectors in the ROM disk */
   desc.sectsize = SECTORSIZE;                           /* The size of one 
sector in bytes */
-  desc.image    = (FAR uint8_t *)romfs_img;             /* File system image */
+  desc.image    = (FAR uint8_t *)chardev_romfs_img;     /* File system image */
 
   ret = boardctl(BOARDIOC_ROMDISK, (uintptr_t)&desc);
   if (ret < 0)
diff --git a/examples/sotest/.gitignore b/examples/sotest/.gitignore
new file mode 100644
index 000000000..9e1d2593e
--- /dev/null
+++ b/examples/sotest/.gitignore
@@ -0,0 +1 @@
+/Kconfig
diff --git a/examples/sotest/Make.defs b/examples/sotest/Make.defs
index 1f732f9ec..6f9fbe6f5 100644
--- a/examples/sotest/Make.defs
+++ b/examples/sotest/Make.defs
@@ -18,6 +18,4 @@
 #
 ############################################################################
 
-ifneq ($(CONFIG_EXAMPLES_SOTEST),)
-CONFIGURED_APPS += $(APPDIR)/examples/sotest
-endif
+include $(wildcard $(APPDIR)/examples/sotest/*/Make.defs)
diff --git a/examples/sotest/Makefile b/examples/sotest/Makefile
index f7a0690e8..6e7bb3af7 100644
--- a/examples/sotest/Makefile
+++ b/examples/sotest/Makefile
@@ -18,41 +18,6 @@
 #
 ############################################################################
 
-include $(APPDIR)/Make.defs
+MENUDESC = "sotest example"
 
-# Shared library example built-in application info
-
-PROGNAME = sotest
-PRIORITY = SCHED_PRIORITY_DEFAULT
-STACKSIZE = $(CONFIG_DEFAULT_TASK_STACKSIZE)
-MODULE = $(CONFIG_EXAMPLES_SOTEST)
-
-# Shared Library Example
-
-ifeq ($(CONFIG_EXAMPLES_SOTEST_BUILTINFS),y)
-CSRCS = romfs.c
-endif
-CSRCS += sot_symtab.c
-lib$(DELIM)sot_symtab.c_CFLAGS = -fno-builtin
-lib$(DELIM)sot_symtab.c_CELFFLAGS = -fno-builtin
-MAINSRC = sotest_main.c
-
-DEPPATH += --dep-path lib
-
-# Build targets
-
-VPATH = lib
-
-ifeq ($(CONFIG_EXAMPLES_SOTEST_BUILTINFS),y)
-lib/romfs.c: build
-endif
-lib/sot_symtab.c: build
-
-.PHONY: build
-build:
-       +$(Q) $(MAKE) -C lib TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" 
CROSSDEV=$(CROSSDEV)
-
-clean::
-       +$(Q) $(MAKE) -C lib TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" 
CROSSDEV=$(CROSSDEV) clean
-
-include $(APPDIR)/Application.mk
+include $(APPDIR)/Directory.mk
diff --git a/examples/sotest/lib/.gitignore b/examples/sotest/lib/.gitignore
deleted file mode 100644
index f41ef9224..000000000
--- a/examples/sotest/lib/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/fsroot
-/romfs.c
-/romfs.img
-/sot_symtab.c
diff --git a/examples/sotest/lib/Makefile b/examples/sotest/lib/Makefile
deleted file mode 100644
index ce1aa3748..000000000
--- a/examples/sotest/lib/Makefile
+++ /dev/null
@@ -1,81 +0,0 @@
-############################################################################
-# apps/examples/sotest/lib/Makefile
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-ALL_SUBDIRS = sotest
-BUILD_SUBDIRS = sotest
-
-ifneq ($(CONFIG_MODLIB_MAXDEPEND),0)
-ALL_SUBDIRS += modprint
-BUILD_SUBDIRS += modprint
-endif
-
-SOTEST_DIR = $(APPDIR)/examples/sotest
-LIB_DIR = $(SOTEST_DIR)/lib
-FSROOT_DIR = $(LIB_DIR)/fsroot
-SYMTAB_SRC = $(LIB_DIR)/sot_symtab.c
-
-ifeq ($(CONFIG_EXAMPLES_SOTEST_BUILTINFS),y)
-  ROMFS_IMG = $(LIB_DIR)/romfs.img
-  ROMFS_SRC = $(LIB_DIR)/romfs.c
-endif
-
-define DIR_template
-$(1)_$(2):
-       +$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" 
FSROOT_DIR="$(FSROOT_DIR)" CROSSDEV=$(CROSSDEV)
-endef
-
-all: $(ROMFS_SRC) $(SYMTAB_SRC)
-.PHONY: all clean install
-
-$(foreach DIR, $(ALL_SUBDIRS), $(eval $(call DIR_template,$(DIR),clean)))
-$(foreach DIR, $(BUILD_SUBDIRS), $(eval $(call DIR_template,$(DIR),install)))
-
-# Install each program in the fsroot directory
-
-install: $(foreach DIR, $(BUILD_SUBDIRS), $(DIR)_install)
-
-ifeq ($(CONFIG_EXAMPLES_SOTEST_BUILTINFS),y)
-# Create the romfs.img file from the populated fsroot directory
-
-$(ROMFS_IMG): install
-       $(Q) genromfs -f $@.tmp -d $(FSROOT_DIR) -V "SOTESTTEST"
-       $(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
-
-# Create the romfs.c file from the romfs.img file
-
-$(ROMFS_SRC): $(ROMFS_IMG)
-       $(Q) (cd $(LIB_DIR) && echo "#include <nuttx/compiler.h>" >$@ && \
-               xxd -i romfs.img | sed -e "s/^unsigned char/const unsigned char 
aligned_data(4)/g" | \
-               sed -e "s/romfs_img/sotest_romfs_img/g" >>$@)
-endif
-
-# Create the exported symbol table
-
-$(SYMTAB_SRC): install
-       $(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(FSROOT_DIR) g_sot | 
sed "/modprint/d" >$@.tmp
-       $(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
-
-# Clean each subdirectory
-
-clean: $(foreach DIR, $(ALL_SUBDIRS), $(DIR)_clean)
-       $(Q) rm -f $(ROMFS_SRC) $(ROMFS_IMG) $(SYMTAB_SRC)
-       $(Q) rm -rf $(FSROOT_DIR)
diff --git a/examples/sotest/lib/modprint/.gitignore 
b/examples/sotest/lib/modprint/.gitignore
deleted file mode 100644
index 791ac9ac0..000000000
--- a/examples/sotest/lib/modprint/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/modprint
diff --git a/examples/sotest/lib/modprint/Makefile 
b/examples/sotest/lib/modprint/Makefile
deleted file mode 100644
index b755b8d54..000000000
--- a/examples/sotest/lib/modprint/Makefile
+++ /dev/null
@@ -1,64 +0,0 @@
-############################################################################
-# apps/examples/sotest/lib/modprint/Makefile
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.  The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-ifeq ($(CONFIG_EXAMPLES_SOTEST_LIBGCC),y)
-LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name 2>/dev/null}"
-ifneq ($(LIBGCC),)
-  LDLIBPATH += -L "${shell dirname $(LIBGCC)}"
-  LDLIBS += -lgcc
-endif
-endif
-
-ifeq ($(CONFIG_EXAMPLES_SOTEST_LIBC),y)
-LDMODULEFLAGS += -Bstatic
-LDLIBPATH +=  -L $(NUTTXLIB)
-endif
-
-ifeq ($(CONFIG_EXAMPLES_SOTEST_LIBC),y)
-LDLIBS += -lc
-endif
-
-BIN = modprint
-
-SRCS = $(BIN).c
-OBJS = $(SRCS:.c=$(OBJEXT))
-
-all: $(BIN)
-.PHONY: all clean install
-
-$(OBJS): %$(OBJEXT): %.c
-       @echo "MODULECC: $<"
-       $(Q) $(MODULECC) -c $(CMODULEFLAGS) $< -o $@
-
-$(BIN): $(OBJS)
-       @echo "MODULELD: $<"
-       $(Q) $(MODULELD) $(LDMODULEFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ 
$(LDLIBS)
-
-$(FSROOT_DIR)/$(BIN): $(BIN)
-       $(Q) mkdir -p $(FSROOT_DIR)
-       $(Q) install $(BIN) $(FSROOT_DIR)/$(BIN)
-
-install: $(FSROOT_DIR)/$(BIN)
-
-clean:
-       $(call DELFILE, $(BIN))
-       $(call CLEAN)
diff --git a/examples/sotest/lib/sotest/.gitignore 
b/examples/sotest/lib/sotest/.gitignore
deleted file mode 100644
index 256c42b57..000000000
--- a/examples/sotest/lib/sotest/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/sotest
diff --git a/examples/sotest/main/.gitignore b/examples/sotest/main/.gitignore
new file mode 100644
index 000000000..cb2478b33
--- /dev/null
+++ b/examples/sotest/main/.gitignore
@@ -0,0 +1,3 @@
+/sotest_symtab.c
+/sotest_romfs.c
+/sotest_romfs.img
diff --git a/examples/sotest/CMakeLists.txt 
b/examples/sotest/main/CMakeLists.txt
similarity index 95%
rename from examples/sotest/CMakeLists.txt
rename to examples/sotest/main/CMakeLists.txt
index f677d8d8b..3e059d984 100644
--- a/examples/sotest/CMakeLists.txt
+++ b/examples/sotest/main/CMakeLists.txt
@@ -1,5 +1,5 @@
 # 
##############################################################################
-# apps/examples/sotest/CMakeLists.txt
+# apps/examples/sotest/main/CMakeLists.txt
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more 
contributor
 # license agreements.  See the NOTICE file distributed with this work for
diff --git a/examples/sotest/Kconfig b/examples/sotest/main/Kconfig
similarity index 100%
rename from examples/sotest/Kconfig
rename to examples/sotest/main/Kconfig
diff --git a/examples/sotest/Make.defs b/examples/sotest/main/Make.defs
similarity index 91%
copy from examples/sotest/Make.defs
copy to examples/sotest/main/Make.defs
index 1f732f9ec..1a382e924 100644
--- a/examples/sotest/Make.defs
+++ b/examples/sotest/main/Make.defs
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/examples/sotest/Make.defs
+# apps/examples/sotest/main/Make.defs
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -19,5 +19,5 @@
 ############################################################################
 
 ifneq ($(CONFIG_EXAMPLES_SOTEST),)
-CONFIGURED_APPS += $(APPDIR)/examples/sotest
+CONFIGURED_APPS += $(APPDIR)/examples/sotest/main
 endif
diff --git a/examples/sotest/Makefile b/examples/sotest/main/Makefile
similarity index 58%
copy from examples/sotest/Makefile
copy to examples/sotest/main/Makefile
index f7a0690e8..17c905703 100644
--- a/examples/sotest/Makefile
+++ b/examples/sotest/main/Makefile
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/examples/sotest/Makefile
+# apps/examples/sotest/main/Makefile
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -29,30 +29,42 @@ MODULE = $(CONFIG_EXAMPLES_SOTEST)
 
 # Shared Library Example
 
-ifeq ($(CONFIG_EXAMPLES_SOTEST_BUILTINFS),y)
-CSRCS = romfs.c
-endif
-CSRCS += sot_symtab.c
-lib$(DELIM)sot_symtab.c_CFLAGS = -fno-builtin
-lib$(DELIM)sot_symtab.c_CELFFLAGS = -fno-builtin
 MAINSRC = sotest_main.c
 
-DEPPATH += --dep-path lib
+SYMTABSRC = sotest_symtab.c
+SYMTABOBJ = $(SYMTABSRC:.c=$(OBJEXT))
+
+$(SYMTABSRC):
+       $(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(BINDIR) g_sot >$@.tmp
+       $(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
 
-# Build targets
 
-VPATH = lib
+$(SYMTABOBJ): %$(OBJEXT): %.c
+       $(call COMPILE, $<, $@, -fno-lto -fno-builtin)
+
 
 ifeq ($(CONFIG_EXAMPLES_SOTEST_BUILTINFS),y)
-lib/romfs.c: build
+
+ROMFSIMG = sotest_romfs.img
+ROMFSSRC = sotest_romfs.c
+ROMFSOBJ = $(ROMFSSRC:.c=$(OBJEXT))
+
+$(ROMFSIMG):
+       $(Q) genromfs -d $(BINDIR) -f $@
+
+$(ROMFSSRC): $(ROMFSIMG)
+       $(Q) (echo "#include <nuttx/compiler.h>" >$@ && \
+               xxd -i $(ROMFSIMG) | sed -e "s/^unsigned char/const unsigned 
char aligned_data(4)/g" >>$@)
+
+$(ROMFSOBJ): %$(OBJEXT): %.c
+       $(call COMPILE, $<, $@, -fno-lto -fno-builtin)
+
 endif
-lib/sot_symtab.c: build
 
-.PHONY: build
-build:
-       +$(Q) $(MAKE) -C lib TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" 
CROSSDEV=$(CROSSDEV)
+postinstall:: $(ROMFSOBJ) $(SYMTABOBJ) $(FSIMG_OBJ)
+       $(call ARLOCK, $(call CONVERT_PATH,$(BIN)), $^)
 
-clean::
-       +$(Q) $(MAKE) -C lib TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" 
CROSSDEV=$(CROSSDEV) clean
+distclean::
+       $(Q) $(call DELFILE, $(SYMTABSRC) $(SYMTABOBJ) $(ROMFSSRC) $(ROMFSIMG) 
$(ROMFSOBJ))
 
 include $(APPDIR)/Application.mk
diff --git a/examples/sotest/sotest_main.c b/examples/sotest/main/sotest_main.c
similarity index 99%
rename from examples/sotest/sotest_main.c
rename to examples/sotest/main/sotest_main.c
index 1446e222e..dbac4b050 100644
--- a/examples/sotest/sotest_main.c
+++ b/examples/sotest/main/sotest_main.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * apps/examples/sotest/sotest_main.c
+ * apps/examples/sotest/main/sotest_main.c
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
diff --git a/examples/sotest/modprint/Kconfig b/examples/sotest/modprint/Kconfig
new file mode 100644
index 000000000..f72f3c094
--- /dev/null
+++ b/examples/sotest/modprint/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
diff --git a/examples/sotest/Make.defs b/examples/sotest/modprint/Make.defs
similarity index 91%
copy from examples/sotest/Make.defs
copy to examples/sotest/modprint/Make.defs
index 1f732f9ec..2d6ae226b 100644
--- a/examples/sotest/Make.defs
+++ b/examples/sotest/modprint/Make.defs
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/examples/sotest/Make.defs
+# apps/examples/sotest/modprint/Make.defs
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -19,5 +19,5 @@
 ############################################################################
 
 ifneq ($(CONFIG_EXAMPLES_SOTEST),)
-CONFIGURED_APPS += $(APPDIR)/examples/sotest
+CONFIGURED_APPS += $(APPDIR)/examples/sotest/modprint
 endif
diff --git a/examples/sotest/Make.defs b/examples/sotest/modprint/Makefile
similarity index 85%
copy from examples/sotest/Make.defs
copy to examples/sotest/modprint/Makefile
index 1f732f9ec..dca51c6f7 100644
--- a/examples/sotest/Make.defs
+++ b/examples/sotest/modprint/Makefile
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/examples/sotest/Make.defs
+# apps/examples/sotest/modprint/Makefile
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -18,6 +18,11 @@
 #
 ############################################################################
 
-ifneq ($(CONFIG_EXAMPLES_SOTEST),)
-CONFIGURED_APPS += $(APPDIR)/examples/sotest
-endif
+include $(APPDIR)/Make.defs
+
+PROGNAME = modprint
+DYNLIB = y
+
+MAINSRC = modprint.c
+
+include $(APPDIR)/Application.mk
diff --git a/examples/sotest/lib/modprint/modprint.c 
b/examples/sotest/modprint/modprint.c
similarity index 98%
rename from examples/sotest/lib/modprint/modprint.c
rename to examples/sotest/modprint/modprint.c
index bb2793ef1..5b48df6c6 100644
--- a/examples/sotest/lib/modprint/modprint.c
+++ b/examples/sotest/modprint/modprint.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * apps/examples/sotest/lib/modprint/modprint.c
+ * apps/examples/sotest/modprint/modprint.c
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
diff --git a/examples/sotest/sotest/Kconfig b/examples/sotest/sotest/Kconfig
new file mode 100644
index 000000000..f72f3c094
--- /dev/null
+++ b/examples/sotest/sotest/Kconfig
@@ -0,0 +1,4 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
diff --git a/examples/sotest/Make.defs b/examples/sotest/sotest/Make.defs
similarity index 91%
copy from examples/sotest/Make.defs
copy to examples/sotest/sotest/Make.defs
index 1f732f9ec..08c4edce1 100644
--- a/examples/sotest/Make.defs
+++ b/examples/sotest/sotest/Make.defs
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/examples/sotest/Make.defs
+# apps/examples/sotest/sotest/Make.defs
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -19,5 +19,5 @@
 ############################################################################
 
 ifneq ($(CONFIG_EXAMPLES_SOTEST),)
-CONFIGURED_APPS += $(APPDIR)/examples/sotest
+CONFIGURED_APPS += $(APPDIR)/examples/sotest/sotest
 endif
diff --git a/examples/sotest/Make.defs b/examples/sotest/sotest/Makefile
similarity index 86%
copy from examples/sotest/Make.defs
copy to examples/sotest/sotest/Makefile
index 1f732f9ec..94eb777a2 100644
--- a/examples/sotest/Make.defs
+++ b/examples/sotest/sotest/Makefile
@@ -1,5 +1,5 @@
 ############################################################################
-# apps/examples/sotest/Make.defs
+# apps/examples/sotest/sotest/Makefile
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -18,6 +18,11 @@
 #
 ############################################################################
 
-ifneq ($(CONFIG_EXAMPLES_SOTEST),)
-CONFIGURED_APPS += $(APPDIR)/examples/sotest
-endif
+include $(APPDIR)/Make.defs
+
+PROGNAME = sotest
+DYNLIB = y
+
+MAINSRC = sotest.c
+
+include $(APPDIR)/Application.mk
diff --git a/examples/sotest/lib/sotest/sotest.c 
b/examples/sotest/sotest/sotest.c
similarity index 99%
rename from examples/sotest/lib/sotest/sotest.c
rename to examples/sotest/sotest/sotest.c
index da09bf9a7..9fe26c19c 100644
--- a/examples/sotest/lib/sotest/sotest.c
+++ b/examples/sotest/sotest/sotest.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * apps/examples/sotest/lib/sotest/sotest.c
+ * apps/examples/sotest/sotest/sotest.c
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with


Reply via email to