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

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

commit 91f55245eb8e6dfe2e8e49d5ee54d1302b82069b
Author: anjiahao <[email protected]>
AuthorDate: Wed Jun 18 14:26:57 2025 +0800

    apps:modify examples elf compile method
    
    rearrange the elf test directory, make the sub-testcase in separate
    directory
    
    Signed-off-by: anjiahao <[email protected]>
---
 examples/elf/.gitignore                |   1 +
 examples/elf/CMakeLists.txt            |   8 +-
 examples/elf/Make.defs                 |   4 +-
 examples/elf/Makefile                  |  45 +---------
 examples/elf/main/.gitignore           |   4 +
 examples/elf/{ => main}/CMakeLists.txt |   4 +-
 examples/elf/{ => main}/Kconfig        |   0
 examples/elf/{ => main}/Make.defs      |   6 +-
 examples/elf/main/Makefile             | 100 +++++++++++++++++++++
 examples/elf/{ => main}/elf_main.c     |  33 ++++++-
 examples/elf/tests/.gitignore          |   1 +
 examples/elf/{ => tests}/Make.defs     |  24 +++--
 examples/elf/tests/Makefile            | 132 +--------------------------
 examples/elf/tests/errno/Kconfig       |   4 +
 examples/elf/tests/errno/Makefile      |  51 ++---------
 examples/elf/tests/hello/Kconfig       |   4 +
 examples/elf/tests/hello/Makefile      |  51 ++---------
 examples/elf/tests/helloxx/Kconfig     |   4 +
 examples/elf/tests/helloxx/Makefile    | 157 +++------------------------------
 examples/elf/tests/longjmp/Kconfig     |   4 +
 examples/elf/tests/longjmp/Makefile    |  51 ++---------
 examples/elf/tests/mutex/Kconfig       |   4 +
 examples/elf/tests/mutex/Makefile      |  51 ++---------
 examples/elf/tests/pthread/Kconfig     |   4 +
 examples/elf/tests/pthread/Makefile    |  51 ++---------
 examples/elf/tests/signal/Kconfig      |   4 +
 examples/elf/tests/signal/Makefile     |  51 ++---------
 examples/elf/tests/struct/Kconfig      |   4 +
 examples/elf/tests/struct/Makefile     |  53 ++---------
 examples/elf/tests/task/Kconfig        |   4 +
 examples/elf/tests/task/Makefile       |  51 ++---------
 31 files changed, 261 insertions(+), 704 deletions(-)

diff --git a/examples/elf/.gitignore b/examples/elf/.gitignore
new file mode 100644
index 000000000..9e1d2593e
--- /dev/null
+++ b/examples/elf/.gitignore
@@ -0,0 +1 @@
+/Kconfig
diff --git a/examples/elf/CMakeLists.txt b/examples/elf/CMakeLists.txt
index 3ca9eeb4b..f5b2b0ee6 100644
--- a/examples/elf/CMakeLists.txt
+++ b/examples/elf/CMakeLists.txt
@@ -20,9 +20,5 @@
 #
 # 
##############################################################################
 
-if(CONFIG_EXAMPLES_ELF)
-  nuttx_add_application(NAME elf SRCS elf_main.c)
-
-  # TODO: tests
-
-endif()
+nuttx_add_subdirectory()
+nuttx_generate_kconfig(MENUDESC "Elf")
diff --git a/examples/elf/Make.defs b/examples/elf/Make.defs
index e01a9d0dd..fe9092e3b 100644
--- a/examples/elf/Make.defs
+++ b/examples/elf/Make.defs
@@ -20,6 +20,4 @@
 #
 ############################################################################
 
-ifneq ($(CONFIG_EXAMPLES_ELF),)
-CONFIGURED_APPS += $(APPDIR)/examples/elf
-endif
+include $(wildcard $(APPDIR)/examples/elf/*/Make.defs)
diff --git a/examples/elf/Makefile b/examples/elf/Makefile
index 8d1e32f13..cde6ca47d 100644
--- a/examples/elf/Makefile
+++ b/examples/elf/Makefile
@@ -20,47 +20,6 @@
 #
 ############################################################################
 
-include $(APPDIR)/Make.defs
+MENUDESC = "Elf example"
 
-# ELF Example
-
-ifeq ($(CONFIG_EXAMPLES_ELF_ROMFS),y)
-CSRCS = romfs.c
-endif
-ifeq ($(CONFIG_EXAMPLES_ELF_CROMFS),y)
-CSRCS = cromfs.c
-endif
-CSRCS += dirlist.c
-CSRCS += symtab.c
-tests$(DELIM)symtab.c_CFLAGS = -fno-builtin
-tests$(DELIM)symtab.c_CELFFLAGS = -fno-builtin
-MAINSRC = elf_main.c
-
-PROGNAME = elf
-PRIORITY = SCHED_PRIORITY_DEFAULT
-STACKSIZE = $(CONFIG_DEFAULT_TASK_STACKSIZE)
-MODULE = $(CONFIG_EXAMPLES_ELF)
-
-DEPPATH := --dep-path tests
-
-# Build targets
-
-VPATH += :tests
-
-ifeq ($(CONFIG_EXAMPLES_ELF_ROMFS),y)
-tests/romfs.c: build
-endif
-ifeq ($(CONFIG_EXAMPLES_ELF_CROMFS),y)
-tests/cromfs.c: build
-endif
-tests/dirlist.c: build
-tests/symtab.c: build
-
-.PHONY: build
-build:
-       +$(Q) $(MAKE) -C tests TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" 
CROSSDEV=$(CROSSDEV)
-
-clean::
-       +$(Q) $(MAKE) -C tests TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" 
CROSSDEV=$(CROSSDEV) clean
-
-include $(APPDIR)/Application.mk
+include $(APPDIR)/Directory.mk
diff --git a/examples/elf/main/.gitignore b/examples/elf/main/.gitignore
new file mode 100644
index 000000000..17739289c
--- /dev/null
+++ b/examples/elf/main/.gitignore
@@ -0,0 +1,4 @@
+/elf_romfs.c
+/elf_romfs.img
+/cromfs.c
+/test_symtab.c
diff --git a/examples/elf/CMakeLists.txt b/examples/elf/main/CMakeLists.txt
similarity index 93%
copy from examples/elf/CMakeLists.txt
copy to examples/elf/main/CMakeLists.txt
index 3ca9eeb4b..3ae5a347e 100644
--- a/examples/elf/CMakeLists.txt
+++ b/examples/elf/main/CMakeLists.txt
@@ -1,7 +1,5 @@
 # 
##############################################################################
-# apps/examples/elf/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
+# apps/examples/elf/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/elf/Kconfig b/examples/elf/main/Kconfig
similarity index 100%
rename from examples/elf/Kconfig
rename to examples/elf/main/Kconfig
diff --git a/examples/elf/Make.defs b/examples/elf/main/Make.defs
similarity index 89%
copy from examples/elf/Make.defs
copy to examples/elf/main/Make.defs
index e01a9d0dd..bc5af5300 100644
--- a/examples/elf/Make.defs
+++ b/examples/elf/main/Make.defs
@@ -1,7 +1,5 @@
 ############################################################################
-# apps/examples/elf/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
+# apps/examples/elf/main/Make.defs
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -21,5 +19,5 @@
 ############################################################################
 
 ifneq ($(CONFIG_EXAMPLES_ELF),)
-CONFIGURED_APPS += $(APPDIR)/examples/elf
+CONFIGURED_APPS += $(APPDIR)/examples/elf/main
 endif
diff --git a/examples/elf/main/Makefile b/examples/elf/main/Makefile
new file mode 100644
index 000000000..0cb59156b
--- /dev/null
+++ b/examples/elf/main/Makefile
@@ -0,0 +1,100 @@
+############################################################################
+# apps/examples/elf/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 = elf
+PRIORITY = SCHED_PRIORITY_DEFAULT
+STACKSIZE = $(CONFIG_DEFAULT_TASK_STACKSIZE)
+MODULE = $(CONFIG_EXAMPLES_ELF)
+
+MAINSRC = elf_main.c
+
+SYMTABSRC = test_symtab.c
+SYMTABOBJ = $(SYMTABSRC:.c=$(OBJEXT))
+
+
+ifneq ($(CONFIG_BUILD_FLAT),y)
+  PASS1_SYMTAB = $(TOPDIR)/pass1/mod_symtab.c
+  MODLUE_NAME = tests
+endif
+
+$(SYMTABSRC):
+       $(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(BINDIR) g_elf >[email protected]
+       $(Q) $(call TESTANDREPLACEFILE, [email protected], $@)
+
+
+$(SYMTABOBJ): %$(OBJEXT): %.c
+       $(call COMPILE, $<, $@, -fno-lto -fno-builtin)
+
+ifeq ($(CONFIG_EXAMPLES_ELF_ROMFS),y)
+
+ROMFSIMG = elf_romfs.img
+ROMFSSRC = elf_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_ELF_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) [email protected]
+       $(Q) $(call TESTANDREPLACEFILE, [email protected], $@)
+
+$(FSIMG_OBJ): %$(OBJEXT): %.c
+       $(call COMPILE, $<, $@, -fno-lto -fno-builtin)
+
+endif
+
+# Copy the symbol table into the kernel pass1/ build directory
+
+ifneq ($(CONFIG_BUILD_FLAT),y)
+$(PASS1_SYMTAB): $(SYMTABSRC)
+       $(Q) install -m 0644 $(SYMTABSRC) $(PASS1_SYMTAB)
+       $(Q) mv $(BINDIR)$(DELIM)$(MODLUE_NAME) .
+endif
+
+postinstall:: $(ROMFSOBJ) $(SYMTABOBJ) $(FSIMG_OBJ) $(PASS1_SYMTAB)
+       $(call ARLOCK, $(call CONVERT_PATH,$(BIN)), $^)
+
+distclean::
+       $(Q) $(call DELFILE, $(SYMTABSRC) $(SYMTABOBJ) $(ROMFSSRC) $(ROMFSIMG) 
$(ROMFSOBJ) $(MODLUE_NAME))
+
+
+include $(APPDIR)/Application.mk
diff --git a/examples/elf/elf_main.c b/examples/elf/main/elf_main.c
similarity index 96%
rename from examples/elf/elf_main.c
rename to examples/elf/main/elf_main.c
index d6950c1c8..23930e1f9 100644
--- a/examples/elf/elf_main.c
+++ b/examples/elf/main/elf_main.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * apps/examples/elf/elf_main.c
+ * apps/examples/elf/main/elf_main.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -132,8 +132,35 @@ extern const unsigned int elf_romfs_img_len;
 #  error "No file system selected"
 #endif
 
-extern const char *dirlist[];
-
+const char *dirlist[] =
+{
+  "errno",
+  "hello",
+  "signal",
+  "struct",
+#ifdef CONFIG_HAVE_CXX
+  "hello++1",
+  "hello++2",
+#  ifdef CONFIG_HAVE_CXXINITIALIZE
+  "hello++3",
+#  endif
+#  ifdef CONFIG_EXAMPLES_ELF_CXX
+  "hello++4",
+  "hello++5",
+#  endif
+#endif
+#ifdef CONFIG_EXAMPLES_ELF_LONGJMP
+  "longjmp"
+#endif
+#ifndef CONFIG_DISABLE_PTHREAD
+  "mutex",
+  "pthread",
+#endif
+#ifndef CONFIG_ARCH_ADDRENV
+  "task",
+#endif
+  NULL
+};
 extern const struct symtab_s g_elf_exports[];
 extern const int g_elf_nexports;
 
diff --git a/examples/elf/tests/.gitignore b/examples/elf/tests/.gitignore
index 416f7e66e..78af96a0d 100644
--- a/examples/elf/tests/.gitignore
+++ b/examples/elf/tests/.gitignore
@@ -6,3 +6,4 @@
 /dirlist.c
 /extfs
 /symtab.c
+/Kconfig
diff --git a/examples/elf/Make.defs b/examples/elf/tests/Make.defs
similarity index 55%
copy from examples/elf/Make.defs
copy to examples/elf/tests/Make.defs
index e01a9d0dd..b8f77f37c 100644
--- a/examples/elf/Make.defs
+++ b/examples/elf/tests/Make.defs
@@ -1,7 +1,5 @@
 ############################################################################
-# apps/examples/elf/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
+# apps/examples/elf/tests/Make.defs
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -20,6 +18,22 @@
 #
 ############################################################################
 
-ifneq ($(CONFIG_EXAMPLES_ELF),)
-CONFIGURED_APPS += $(APPDIR)/examples/elf
+ifeq ($(CONFIG_EXAMPLES_ELF),y)
+  CONFIGURED_APPS += $(APPDIR)/examples/elf/tests/errno
+  CONFIGURED_APPS += $(APPDIR)/examples/elf/tests/hello
+  CONFIGURED_APPS += $(APPDIR)/examples/elf/tests/signal
+  CONFIGURED_APPS += $(APPDIR)/examples/elf/tests/struct
+  ifeq ($(CONFIG_HAVE_CXX),y)
+    CONFIGURED_APPS += $(APPDIR)/examples/elf/tests/helloxx
+  endif
+  ifeq ($(CONFIG_EXAMPLES_ELF_LONGJMP),y)
+    CONFIGURED_APPS += $(APPDIR)/examples/elf/tests/longjmp
+  endif
+  ifneq ($(CONFIG_DISABLE_PTHREAD),y)
+    CONFIGURED_APPS += $(APPDIR)/examples/elf/tests/mutex
+    CONFIGURED_APPS += $(APPDIR)/examples/elf/tests/pthread
+  endif
+  ifneq ($(CONFIG_ARCH_ADDRENV),y)
+    CONFIGURED_APPS += $(APPDIR)/examples/elf/tests/task
+  endif
 endif
diff --git a/examples/elf/tests/Makefile b/examples/elf/tests/Makefile
index f73d31fc9..741d9d7a9 100644
--- a/examples/elf/tests/Makefile
+++ b/examples/elf/tests/Makefile
@@ -20,134 +20,6 @@
 #
 ############################################################################
 
-include $(APPDIR)/Make.defs
+MENUDESC = "Elf tests example"
 
-ALL_SUBDIRS = errno hello helloxx longjmp mutex pthread signal task struct
-BUILD_SUBDIRS = errno hello struct signal
-
-ifeq ($(CONFIG_HAVE_CXX),y)
-BUILD_SUBDIRS += helloxx
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_LONGJMP),y)
-BUILD_SUBDIRS += longjmp
-endif
-
-ifneq ($(CONFIG_DISABLE_PTHREAD),y)
-BUILD_SUBDIRS += mutex pthread
-endif
-
-ifneq ($(CONFIG_ARCH_ADDRENV),y)
-BUILD_SUBDIRS += task
-endif
-
-ELF_DIR = $(APPDIR)/examples/elf
-TESTS_DIR = $(ELF_DIR)/tests
-DIRLIST_SRC = $(TESTS_DIR)/dirlist.c
-SYMTAB_SRC = $(TESTS_DIR)/symtab.c
-
-ifeq ($(CONFIG_EXAMPLES_ELF_ROMFS),y)
-  FSIMG_SUBDIR = romfs
-  FSIMG_DIR = $(TESTS_DIR)/$(FSIMG_SUBDIR)
-  ROMFS_IMG = $(TESTS_DIR)/romfs.img
-  FSIMG_SRC = $(TESTS_DIR)/romfs.c
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_CROMFS),y)
-  NXTOOLDIR = $(TOPDIR)/tools
-  GENCROMFSSRC = gencromfs.c
-  GENCROMFSEXE = gencromfs$(HOSTEXEEXT)
-
-  FSIMG_SUBDIR = cromfs
-  FSIMG_DIR = $(TESTS_DIR)/$(FSIMG_SUBDIR)
-  FSIMG_SRC = $(TESTS_DIR)/cromfs.c
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_EXTERN),y)
-  FSIMG_SUBDIR = extfs
-  FSIMG_DIR = $(TESTS_DIR)/$(FSIMG_SUBDIR)
-endif
-
-# generate the romfs image in case the fs type is romfs
-# the FSIMG_SRC is not actually generated.
-
-ifeq ($(CONFIG_EXAMPLES_ELF_FSTYPE), "romfs")
-  ROMFS_IMG = $(TESTS_DIR)/romfs.img
-  FSIMG_SRC = $(TESTS_DIR)/romfs.c
-endif
-
-define DIR_template
-$(1)_$(2):
-       +$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" 
FSIMG_DIR="$(FSIMG_DIR)" CROSSDEV=$(CROSSDEV)
-endef
-
-all: $(FSIMG_SRC) $(DIRLIST_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 file system image directory
-
-install: $(foreach DIR, $(BUILD_SUBDIRS), $(DIR)_install)
-
-ifeq ($(CONFIG_EXAMPLES_ELF_ROMFS),y)
-# Create the romfs.img file from the populated romfs directory
-
-$(ROMFS_IMG): install
-       $(Q) genromfs -f [email protected] -d $(FSIMG_DIR) -V "ELFTEST"
-       $(Q) $(call TESTANDREPLACEFILE, [email protected], $@)
-
-# Create the romfs.c file from the romfs.img file
-
-$(FSIMG_SRC): $(ROMFS_IMG)
-       $(Q) (cd $(TESTS_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/elf_romfs_img/g" >>$@)
-
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_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.h header file from the populated cromfs directory
-
-$(FSIMG_SRC): install $(NXTOOLDIR)/$(GENCROMFSEXE)
-       $(Q) $(NXTOOLDIR)/$(GENCROMFSEXE) $(FSIMG_DIR) [email protected]
-       $(Q) $(call TESTANDREPLACEFILE, [email protected], $@)
-
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_FSTYPE),"romfs")
-# Create the romfs.img file from the populated romfs directory
-
-$(ROMFS_IMG): install
-       $(Q) genromfs -f [email protected] -d $(FSIMG_DIR) -V "ELFTEST"
-       $(Q) $(call TESTANDREPLACEFILE, [email protected], $@)
-
-# Create the romfs.c file from the romfs.img file
-
-$(FSIMG_SRC): $(ROMFS_IMG)
-
-endif
-
-# Create the dirlist.h header file from the file system image directory
-
-$(DIRLIST_SRC): install
-       $(Q) $(TESTS_DIR)/mkdirlist.sh $(FSIMG_DIR) >[email protected]
-       $(Q) $(call TESTANDREPLACEFILE, [email protected], $@)
-
-# Create the exported symbol table
-
-$(SYMTAB_SRC): install
-       $(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(FSIMG_DIR) g_elf 
>[email protected]
-       $(Q) $(call TESTANDREPLACEFILE, [email protected], $@)
-
-# Clean each subdirectory
-
-clean: $(foreach DIR, $(ALL_SUBDIRS), $(DIR)_clean)
-       $(Q) rm -f $(FSIMG_SRC) $(DIRLIST_SRC) $(ROMFS_IMG) $(SYMTAB_SRC)
-       $(Q) rm -rf $(FSIMG_DIR)
+include $(APPDIR)/Directory.mk
diff --git a/examples/elf/tests/errno/Kconfig b/examples/elf/tests/errno/Kconfig
new file mode 100644
index 000000000..f72f3c094
--- /dev/null
+++ b/examples/elf/tests/errno/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/elf/tests/errno/Makefile 
b/examples/elf/tests/errno/Makefile
index 2f9d2a13a..ee383144d 100644
--- a/examples/elf/tests/errno/Makefile
+++ b/examples/elf/tests/errno/Makefile
@@ -22,49 +22,10 @@
 
 include $(APPDIR)/Make.defs
 
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH += -L $(NUTTXLIB)
-else
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH +=  -L $(NUTTXLIB)
-endif
-endif
+PROGNAME  = errno
+PRIORITY  = 100
+STACKSIZE = $(CONFIG_ELF_STACKSIZE)
+MODULE    = m
+MAINSRC   = errno.c
 
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDLIBS += -lc
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDLIBS += -lproxies
-endif
-
-BIN = errno
-
-SRCS = $(BIN).c
-OBJS = $(SRCS:.c=$(OBJEXT))
-
-all: $(BIN)
-.PHONY: all clean install
-
-$(OBJS): %$(OBJEXT): %.c
-       @echo "CC: $<"
-       $(Q) $(CC) -c $(CELFFLAGS) $< -o $@
-
-$(BIN): $(OBJS)
-       @echo "LD: $<"
-       $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
-
-$(FSIMG_DIR)/$(BIN): $(BIN)
-       $(Q) mkdir -p $(FSIMG_DIR)
-       $(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN)
-endif
-
-install: $(FSIMG_DIR)/$(BIN)
-
-clean:
-       $(call DELFILE, $(BIN))
-       $(call CLEAN)
+include $(APPDIR)/Application.mk
diff --git a/examples/elf/tests/hello/Kconfig b/examples/elf/tests/hello/Kconfig
new file mode 100644
index 000000000..f72f3c094
--- /dev/null
+++ b/examples/elf/tests/hello/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/elf/tests/hello/Makefile 
b/examples/elf/tests/hello/Makefile
index 88ec0f0a8..6920b1522 100644
--- a/examples/elf/tests/hello/Makefile
+++ b/examples/elf/tests/hello/Makefile
@@ -22,49 +22,10 @@
 
 include $(APPDIR)/Make.defs
 
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH += -L $(NUTTXLIB)
-else
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH +=  -L $(NUTTXLIB)
-endif
-endif
+PROGNAME  = hello
+PRIORITY  = 100
+STACKSIZE = $(CONFIG_ELF_STACKSIZE)
+MODULE    = m
+MAINSRC   = hello.c
 
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDLIBS += -lc
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDLIBS += -lproxies
-endif
-
-BIN = hello
-
-SRCS = $(BIN).c
-OBJS = $(SRCS:.c=$(OBJEXT))
-
-all: $(BIN)
-.PHONY: all clean install
-
-$(OBJS): %$(OBJEXT): %.c
-       @echo "CC: $<"
-       $(Q) $(CC) -c $(CELFFLAGS) $< -o $@
-
-$(BIN): $(OBJS)
-       @echo "LD: $<"
-       $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
-
-$(FSIMG_DIR)/$(BIN): $(BIN)
-       $(Q) mkdir -p $(FSIMG_DIR)
-       $(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN)
-endif
-
-install: $(FSIMG_DIR)/$(BIN)
-
-clean:
-       $(call DELFILE, $(BIN))
-       $(call CLEAN)
+include $(APPDIR)/Application.mk
diff --git a/examples/elf/tests/helloxx/Kconfig 
b/examples/elf/tests/helloxx/Kconfig
new file mode 100644
index 000000000..f72f3c094
--- /dev/null
+++ b/examples/elf/tests/helloxx/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/elf/tests/helloxx/Makefile 
b/examples/elf/tests/helloxx/Makefile
index b2f276834..667bf453d 100644
--- a/examples/elf/tests/helloxx/Makefile
+++ b/examples/elf/tests/helloxx/Makefile
@@ -22,156 +22,19 @@
 
 include $(APPDIR)/Make.defs
 
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH += -L $(NUTTXLIB)
-else
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH +=  -L $(NUTTXLIB)
-endif
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDLIBS += -lc
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDLIBS += -lproxies
-endif
-
-BIN1 = hello++1
-ALL_BIN = $(FSIMG_DIR)/$(BIN1)
-BIN2 = hello++2
-ALL_BIN += $(FSIMG_DIR)/$(BIN2)
-ifeq ($(CONFIG_HAVE_CXXINITIALIZE),y)
-BIN3 = hello++3
-ALL_BIN += $(FSIMG_DIR)/$(BIN3)
-ifeq ($(CONFIG_EXAMPLES_ELF_CXX),y)
-BIN4 = hello++4
-ALL_BIN += $(FSIMG_DIR)/$(BIN4)
-BIN5 = hello++5
-ALL_BIN += $(FSIMG_DIR)/$(BIN5)
-endif
-endif
-
-SRCS1 = $(BIN1).c
-OBJS1 = $(SRCS1:.c=$(OBJEXT))
-
-SRCS2 = $(BIN2).c
-OBJS2 = $(SRCS2:.c=$(OBJEXT))
-
-ifeq ($(CONFIG_HAVE_CXXINITIALIZE),y)
-SRCS3 = $(BIN3).c
-OBJS3 = $(SRCS3:.c=$(OBJEXT))
-ifeq ($(CONFIG_EXAMPLES_ELF_CXX),y)
-SRCS4 = $(BIN4).c
-OBJS4 = $(SRCS4:.c=$(OBJEXT))
-SRCS5 = $(BIN5).c
-OBJS5 = $(SRCS5:.c=$(OBJEXT))
-endif
-endif
-
-SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5)
-OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5)
-
-LDLIBSTDC_STUBS_DIR    = $(TOPDIR)/libxx
-LDLIBSTDC_STUBS_LIB    = $(LDLIBSTDC_STUBS_DIR)/liblibxx.a
-
-all: $(BIN1) $(BIN2) $(BIN3) $(BIN4) $(BIN5)
-.PHONY: all clean install
-
-$(OBJS): %$(OBJEXT): %.cxx
-       @echo "CC: $<"
-       $(Q) $(CXX) -c $(CXXELFFLAGS) $< -o $@
-
-# This contains libstdc++ stubs to that you can build C++ code
-# without actually having libstdc++
-
-$(LDLIBSTDC_STUBS_LIB):
-       $(Q) $(MAKE) -C $(LDLIBSTDC_STUBS_DIR) TOPDIR=$(TOPDIR)
-
-# BIN1 and BIN2 link just like C code because they contain no
-# static constructors.  BIN1 is equivalent to a C hello world;
-# BIN2 contains a class that implements hello world, but it is
-# not statically initialized.
-
-$(BIN1): $(OBJS1)
-       @echo "LD: $<"
-       $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
-
-$(BIN2): $(OBJS2)
-       @echo "LD: $<"
-       $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
-
-# BIN3 is equivalent to BIN2 except that is uses static initializers
-
+PROGNAME  = hello++1 hello++2
+PRIORITY  = 100
+STACKSIZE = $(CONFIG_ELF_STACKSIZE)
+MODULE    = m
+MAINSRC   = hello++1.cxx hello++2.cxx
 ifeq ($(CONFIG_HAVE_CXXINITIALIZE),y)
-$(BIN3): $(OBJS3)
-       @echo "LD: $<"
-       $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
-
-# BIN4 is similar to BIN3 except that it uses the streams code from libstdc++
-# Both BIN4 and BIN5 use exceptions
-# NOTE:  libstdc++ is not available for NuttX as of this writing
-#
-ifeq ($(CONFIG_EXAMPLES_ELF_CXX),y)
-ifeq ($(CONFIG_CXX_EXCEPTION),y)
-$(BIN4): $(OBJS4)
-       @echo "LD: $<"
-       $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
-$(BIN5): $(OBJS5)
-       @echo "LD: $<"
-       $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
-endif
-endif
-endif
-
-$(FSIMG_DIR)/$(BIN1): $(BIN1)
-       $(Q) mkdir -p $(FSIMG_DIR)
-       $(Q) install $(BIN1) $(FSIMG_DIR)/$(BIN1)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN1)
-endif
-
-$(FSIMG_DIR)/$(BIN2): $(BIN2)
-       $(Q) mkdir -p $(FSIMG_DIR)
-       $(Q) install $(BIN2) $(FSIMG_DIR)/$(BIN2)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN2)
-endif
-
-ifeq ($(CONFIG_HAVE_CXXINITIALIZE),y)
-$(FSIMG_DIR)/$(BIN3): $(BIN3)
-       $(Q) mkdir -p $(FSIMG_DIR)
-       $(Q) install $(BIN3) $(FSIMG_DIR)/$(BIN3)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN3)
+  PROGNAME += hello++3
+  MAINSRC  += hello++3.cxx
 endif
 
 ifeq ($(CONFIG_EXAMPLES_ELF_CXX),y)
-$(FSIMG_DIR)/$(BIN4): $(BIN4)
-       $(Q) mkdir -p $(FSIMG_DIR)
-       $(Q) install $(BIN4) $(FSIMG_DIR)/$(BIN4)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN4)
+  PROGNAME += hello++4 hello++5
+  MAINSRC  += hello++4.cxx hello++5.cxx
 endif
 
-$(FSIMG_DIR)/$(BIN5): $(BIN5)
-       $(Q) mkdir -p $(FSIMG_DIR)
-       $(Q) install $(BIN5) $(FSIMG_DIR)/$(BIN5)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN5)
-endif
-endif
-endif
-
-install: $(ALL_BIN)
-
-clean:
-       $(call DELFILE, $(BIN1))
-       $(call DELFILE, $(BIN2))
-       $(call DELFILE, $(BIN3))
-       $(call DELFILE, $(BIN4))
-       $(call DELFILE, $(BIN5))
-       $(call CLEAN)
+include $(APPDIR)/Application.mk
diff --git a/examples/elf/tests/longjmp/Kconfig 
b/examples/elf/tests/longjmp/Kconfig
new file mode 100644
index 000000000..f72f3c094
--- /dev/null
+++ b/examples/elf/tests/longjmp/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/elf/tests/longjmp/Makefile 
b/examples/elf/tests/longjmp/Makefile
index fa792e6ff..a5e482f28 100644
--- a/examples/elf/tests/longjmp/Makefile
+++ b/examples/elf/tests/longjmp/Makefile
@@ -22,49 +22,10 @@
 
 include $(APPDIR)/Make.defs
 
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH += -L $(NUTTXLIB)
-else
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH +=  -L $(NUTTXLIB)
-endif
-endif
+PROGNAME  = longjmp
+PRIORITY  = 100
+STACKSIZE = $(CONFIG_ELF_STACKSIZE)
+MODULE    = m
+MAINSRC   = longjmp.c
 
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDLIBS += -lc
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDLIBS += -lproxies
-endif
-
-BIN = longjmp
-
-SRCS = $(BIN).c
-OBJS = $(SRCS:.c=$(OBJEXT))
-
-all: $(BIN)
-.PHONY: all clean install
-
-$(OBJS): %$(OBJEXT): %.c
-       @echo "CC: $<"
-       $(Q) $(CC) -c $(CELFFLAGS) $< -o $@
-
-$(BIN): $(OBJS)
-       @echo "LD: $<"
-       $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
-
-$(FSIMG_DIR)/$(BIN): $(BIN)
-       $(Q) mkdir -p $(FSIMG_DIR)
-       $(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN)
-endif
-
-install: $(FSIMG_DIR)/$(BIN)
-
-clean:
-       $(call DELFILE, $(BIN))
-       $(call CLEAN)
+include $(APPDIR)/Application.mk
diff --git a/examples/elf/tests/mutex/Kconfig b/examples/elf/tests/mutex/Kconfig
new file mode 100644
index 000000000..f72f3c094
--- /dev/null
+++ b/examples/elf/tests/mutex/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/elf/tests/mutex/Makefile 
b/examples/elf/tests/mutex/Makefile
index 5fec89d3c..fe3619513 100644
--- a/examples/elf/tests/mutex/Makefile
+++ b/examples/elf/tests/mutex/Makefile
@@ -22,49 +22,10 @@
 
 include $(APPDIR)/Make.defs
 
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH += -L $(NUTTXLIB)
-else
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH +=  -L $(NUTTXLIB)
-endif
-endif
+PROGNAME  = mutex
+PRIORITY  = 100
+STACKSIZE = $(CONFIG_ELF_STACKSIZE)
+MODULE    = m
+MAINSRC   = mutex.c
 
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDLIBS += -lc
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDLIBS += -lproxies
-endif
-
-BIN = mutex
-
-SRCS = $(BIN).c
-OBJS = $(SRCS:.c=$(OBJEXT))
-
-all: $(BIN)
-.PHONY: all clean install
-
-$(OBJS): %$(OBJEXT): %.c
-       @echo "CC: $<"
-       $(Q) $(CC) -c $(CELFFLAGS) $< -o $@
-
-$(BIN): $(OBJS)
-       @echo "LD: $<"
-       $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
-
-$(FSIMG_DIR)/$(BIN): $(BIN)
-       $(Q) mkdir -p $(FSIMG_DIR)
-       $(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN)
-endif
-
-install: $(FSIMG_DIR)/$(BIN)
-
-clean:
-       $(call DELFILE, $(BIN))
-       $(call CLEAN)
+include $(APPDIR)/Application.mk
diff --git a/examples/elf/tests/pthread/Kconfig 
b/examples/elf/tests/pthread/Kconfig
new file mode 100644
index 000000000..f72f3c094
--- /dev/null
+++ b/examples/elf/tests/pthread/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/elf/tests/pthread/Makefile 
b/examples/elf/tests/pthread/Makefile
index 61108bc5f..b1ca8c70d 100644
--- a/examples/elf/tests/pthread/Makefile
+++ b/examples/elf/tests/pthread/Makefile
@@ -22,49 +22,10 @@
 
 include $(APPDIR)/Make.defs
 
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH += -L $(NUTTXLIB)
-else
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH +=  -L $(NUTTXLIB)
-endif
-endif
+PROGNAME  = pthread
+PRIORITY  = 100
+STACKSIZE = $(CONFIG_ELF_STACKSIZE)
+MODULE    = m
+MAINSRC   = pthread.c
 
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDLIBS += -lc
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDLIBS += -lproxies
-endif
-
-BIN = pthread
-
-SRCS = $(BIN).c
-OBJS = $(SRCS:.c=$(OBJEXT))
-
-all: $(BIN)
-.PHONY: all clean install
-
-$(OBJS): %$(OBJEXT): %.c
-       @echo "CC: $<"
-       $(Q) $(CC) -c $(CELFFLAGS) $< -o $@
-
-$(BIN): $(OBJS)
-       @echo "LD: $<"
-       $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
-
-$(FSIMG_DIR)/$(BIN): $(BIN)
-       $(Q) mkdir -p $(FSIMG_DIR)
-       $(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN)
-endif
-
-install: $(FSIMG_DIR)/$(BIN)
-
-clean:
-       $(call DELFILE, $(BIN))
-       $(call CLEAN)
+include $(APPDIR)/Application.mk
diff --git a/examples/elf/tests/signal/Kconfig 
b/examples/elf/tests/signal/Kconfig
new file mode 100644
index 000000000..f72f3c094
--- /dev/null
+++ b/examples/elf/tests/signal/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/elf/tests/signal/Makefile 
b/examples/elf/tests/signal/Makefile
index 21df11dd0..64d674033 100644
--- a/examples/elf/tests/signal/Makefile
+++ b/examples/elf/tests/signal/Makefile
@@ -22,49 +22,10 @@
 
 include $(APPDIR)/Make.defs
 
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH += -L $(NUTTXLIB)
-else
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH +=  -L $(NUTTXLIB)
-endif
-endif
+PROGNAME  = signal
+PRIORITY  = 100
+STACKSIZE = $(CONFIG_ELF_STACKSIZE)
+MODULE    = m
+MAINSRC   = signal.c
 
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDLIBS += -lc
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDLIBS += -lproxies
-endif
-
-BIN = signal
-
-SRCS = $(BIN).c
-OBJS = $(SRCS:.c=$(OBJEXT))
-
-all: $(BIN)
-.PHONY: all clean install
-
-$(OBJS): %$(OBJEXT): %.c
-       @echo "CC: $<"
-       $(Q) $(CC) -c $(CELFFLAGS) $< -o $@
-
-$(BIN): $(OBJS)
-       @echo "LD: $<"
-       $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
-
-$(FSIMG_DIR)/$(BIN): $(BIN)
-       $(Q) mkdir -p $(FSIMG_DIR)
-       $(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN)
-endif
-
-install: $(FSIMG_DIR)/$(BIN)
-
-clean:
-       $(call DELFILE, $(BIN))
-       $(call CLEAN)
+include $(APPDIR)/Application.mk
diff --git a/examples/elf/tests/struct/Kconfig 
b/examples/elf/tests/struct/Kconfig
new file mode 100644
index 000000000..f72f3c094
--- /dev/null
+++ b/examples/elf/tests/struct/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/elf/tests/struct/Makefile 
b/examples/elf/tests/struct/Makefile
index 990d990c2..88ab66f3f 100644
--- a/examples/elf/tests/struct/Makefile
+++ b/examples/elf/tests/struct/Makefile
@@ -22,48 +22,11 @@
 
 include $(APPDIR)/Make.defs
 
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH += -L $(NUTTXLIB)
-else
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH +=  -L $(NUTTXLIB)
-endif
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDLIBS += -lc
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDLIBS += -lproxies
-endif
-
-BIN  = struct
-SRCS = struct_main.c struct_dummy.c
-OBJS = $(SRCS:.c=$(OBJEXT))
-
-all: $(BIN)
-.PHONY: all clean install
-
-$(OBJS): %$(OBJEXT): %.c
-       @echo "CC: $<"
-       $(Q) $(CC) -c $(CELFFLAGS) $< -o $@
-
-$(BIN): $(OBJS)
-       @echo "LD: $<"
-       $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
-
-$(FSIMG_DIR)/$(BIN): $(BIN)
-       $(Q) mkdir -p $(FSIMG_DIR)
-       $(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN)
-endif
-
-install: $(FSIMG_DIR)/$(BIN)
-
-clean:
-       $(call DELFILE, $(BIN))
-       $(call CLEAN)
+PROGNAME  = struct
+PRIORITY  = 100
+STACKSIZE = $(CONFIG_ELF_STACKSIZE)
+MODULE    = m
+CSRCS     = struct_dummy.c
+MAINSRC   = struct_main.c
+
+include $(APPDIR)/Application.mk
diff --git a/examples/elf/tests/task/Kconfig b/examples/elf/tests/task/Kconfig
new file mode 100644
index 000000000..f72f3c094
--- /dev/null
+++ b/examples/elf/tests/task/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/elf/tests/task/Makefile b/examples/elf/tests/task/Makefile
index b57b98885..09424ac96 100644
--- a/examples/elf/tests/task/Makefile
+++ b/examples/elf/tests/task/Makefile
@@ -22,49 +22,10 @@
 
 include $(APPDIR)/Make.defs
 
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH += -L $(NUTTXLIB)
-else
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDELFFLAGS += -Bstatic
-LDLIBPATH +=  -L $(NUTTXLIB)
-endif
-endif
+PROGNAME  = task
+PRIORITY  = 100
+STACKSIZE = $(CONFIG_ELF_STACKSIZE)
+MODULE    = m
+MAINSRC   = task.c
 
-ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y)
-LDLIBS += -lc
-endif
-
-ifeq ($(CONFIG_EXAMPLES_ELF_SYSCALL),y)
-LDLIBS += -lproxies
-endif
-
-BIN = task
-
-SRCS = $(BIN).c
-OBJS = $(SRCS:.c=$(OBJEXT))
-
-all: $(BIN)
-.PHONY: all clean install
-
-$(OBJS): %$(OBJEXT): %.c
-       @echo "CC: $<"
-       $(Q) $(CC) -c $(CELFFLAGS) $< -o $@
-
-$(BIN): $(OBJS)
-       @echo "LD: $<"
-       $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
-
-$(FSIMG_DIR)/$(BIN): $(BIN)
-       $(Q) mkdir -p $(FSIMG_DIR)
-       $(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)
-ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
-       $(Q) $(STRIP) $(FSIMG_DIR)/$(BIN)
-endif
-
-install: $(FSIMG_DIR)/$(BIN)
-
-clean:
-       $(call DELFILE, $(BIN))
-       $(call CLEAN)
+include $(APPDIR)/Application.mk


Reply via email to