summaryrefslogtreecommitdiff
path: root/apps/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'apps/Makefile')
-rw-r--r--apps/Makefile38
1 files changed, 31 insertions, 7 deletions
diff --git a/apps/Makefile b/apps/Makefile
index 40cae5a40..6622932a0 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -49,23 +49,44 @@ BUILTIN_APPS_DIR =
ifeq ($(CONFIG_BUILTIN_APPS_NUTTX),y)
-# Individual application: HELLO
+# BUILTIN_APPS is the list of all configured built-in directories/built action
+
+BUILTIN_APPS =
ifeq ($(CONFIG_BUILTIN_APPS_HELLO),y)
-BUILTIN_APPS_DIR += hello
-BUILTIN_APPS_BUILT += hello/.built_always
+BUILTIN_APPS += hello/.built_always
endif
ifeq ($(CONFIG_BUILTIN_APPS_POWEROFF),y)
-BUILTIN_APPS_DIR += poweroff
-BUILTIN_APPS_BUILT += poweroff/.built_always
+BUILTIN_APPS += poweroff/.built_always
endif
ifeq ($(CONFIG_BUILTIN_APPS_JVM),y)
-BUILTIN_APPS_DIR += jvm
-BUILTIN_APPS_BUILT += jvm/.built_always
+BUILTIN_APPS += jvm/.built_always
endif
+# AVAILABLE_APPS is the list of currently available application directories
+
+AVAILABLE_APPS =
+
+define ADD_AVAILABLE
+AVAILABLE_APPS += ${shell DIR=`echo $1 | cut -d'/' -f1`; if [ -r $$DIR/Makefile ]; then echo "$1"; fi}
+endef
+
+define BUILTIN_ADD_APP
+BUILTIN_APPS_DIR += ${shell echo $1 | cut -d'/' -f1}
+endef
+
+define BUILTIN_ADD_BUILT
+BUILTIN_APPS_BUILT += ${shell echo $1 | cut -d'/' -f2}
+endef
+
+# Create the list of applications to build
+
+$(foreach BUILTIN, $(BUILTIN_APPS), $(eval $(call ADD_AVAILABLE,$(BUILTIN))))
+$(foreach APP, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_APP,$(APP))))
+$(foreach BUILT, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_BUILT,$(BUILT))))
+
# end of application list
endif
@@ -122,5 +143,8 @@ clean:
distclean: clean
@rm -f Make.dep .depend
+ @rm -f exec_nuttapp_list.h
+ @rm -f exec_nuttapp_proto.h
-include Make.dep
+