From 28e631b8295d4668f86c0f06a99be9dc93edd3fa Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Thu, 13 Sep 2018 15:21:04 +0200 Subject: [PATCH 1/5] makefiles/app_dirs.inc.mk: add tests applications subdirs --- makefiles/app_dirs.inc.mk | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/makefiles/app_dirs.inc.mk b/makefiles/app_dirs.inc.mk index ddc49f2fd7e9..582e67315f5c 100644 --- a/makefiles/app_dirs.inc.mk +++ b/makefiles/app_dirs.inc.mk @@ -3,16 +3,40 @@ # fallback so empty RIOTBASE won't lead to "/examples/" RIOTBASE ?= . +# Define the list of tests sudirectories that contain application directories +TEST_APPLICATIONS_SUBDIRS := \ + arch \ + bench \ + boards \ + bootloaders \ + build_system \ + core \ + cpp \ + drivers \ + periph \ + pkg \ + sys \ + sys/net \ + # +TEST_APPLICATIONS_SUBDIRS := $(addprefix tests/,$(TEST_APPLICATIONS_SUBDIRS)) + +# Prepare the list of application directories +APPLICATION_DIRS := \ + fuzzing \ + bootloaders \ + examples \ + tests \ + $(TEST_APPLICATIONS_SUBDIRS) \ + # + +APPLICATION_DIRS := $(addprefix $(RIOTBASE)/,$(APPLICATION_DIRS)) +APPLICATION_DIRS := $(addsuffix /*/Makefile,$(APPLICATION_DIRS)) + # 1. use wildcard to find Makefiles # 2. use patsubst to drop trailing "/" # 3. use patsubst to drop possible leading "./" # 4. sort -APPLICATION_DIRS := $(sort $(patsubst ./%,%,$(patsubst %/,%,$(dir $(wildcard \ - $(RIOTBASE)/fuzzing/*/Makefile \ - $(RIOTBASE)/bootloaders/*/Makefile \ - $(RIOTBASE)/examples/*/Makefile \ - $(RIOTBASE)/tests/*/Makefile \ - ))))) +APPLICATION_DIRS := $(sort $(patsubst ./%,%,$(patsubst %/,%,$(dir $(wildcard $(APPLICATION_DIRS)))))) info-applications: @for dir in $(APPLICATION_DIRS); do echo $$dir; done From 70b274187fd8ccec1aa258dfdfd02237212eb385 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Thu, 11 Feb 2021 21:56:39 +0100 Subject: [PATCH 2/5] makefiles/app_dirs.inc.mk: add examples application subdirs --- makefiles/app_dirs.inc.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/makefiles/app_dirs.inc.mk b/makefiles/app_dirs.inc.mk index 582e67315f5c..53b4a4488a94 100644 --- a/makefiles/app_dirs.inc.mk +++ b/makefiles/app_dirs.inc.mk @@ -3,6 +3,20 @@ # fallback so empty RIOTBASE won't lead to "/examples/" RIOTBASE ?= . +# Define the list of examples subdirectories that container application directories +EXAMPLES_APPLICATIONS_SUBDIRS := \ + ble \ + coap \ + cord \ + dtls \ + gnrc \ + icn \ + lora \ + mqtt \ + posix \ + # +EXAMPLES_APPLICATIONS_SUBDIRS := $(addprefix examples/,$(EXAMPLES_APPLICATIONS_SUBDIRS)) + # Define the list of tests sudirectories that contain application directories TEST_APPLICATIONS_SUBDIRS := \ arch \ @@ -26,6 +40,7 @@ APPLICATION_DIRS := \ bootloaders \ examples \ tests \ + $(EXAMPLES_APPLICATIONS_SUBDIRS) \ $(TEST_APPLICATIONS_SUBDIRS) \ # From b45b4269e9b42af55e62d2fdb63b80dff1cb551e Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 12 Feb 2021 09:36:29 +0100 Subject: [PATCH 3/5] Makefile.include: add way to prevent non listed subdirectories --- Makefile.include | 8 ++++++++ makefiles/app_dirs.inc.mk | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile.include b/Makefile.include index 0e66ee4a6e49..ce6bf6e369c9 100644 --- a/Makefile.include +++ b/Makefile.include @@ -202,6 +202,14 @@ include $(RIOTMAKE)/boards.inc.mk # Debug targets for build system migration include $(RIOTMAKE)/dependencies_debug.inc.mk +# List all available applications +include $(RIOTMAKE)/app_dirs.inc.mk + +ifeq (,$(filter $(APPDIR),$(APPLICATION_DIRS_ABSOLUTE))) + $(error Application parent directory is not listed in the list of examples \ + or tests subdirectories. Please update 'makefiles/app_dirs.inc.mk') +endif + # Use TOOLCHAIN environment variable to select the toolchain to use. # If native, TOOLCHAIN for OSX is llvm ifeq ($(BOARD),native) diff --git a/makefiles/app_dirs.inc.mk b/makefiles/app_dirs.inc.mk index 53b4a4488a94..80c7ebd96a7b 100644 --- a/makefiles/app_dirs.inc.mk +++ b/makefiles/app_dirs.inc.mk @@ -44,14 +44,14 @@ APPLICATION_DIRS := \ $(TEST_APPLICATIONS_SUBDIRS) \ # -APPLICATION_DIRS := $(addprefix $(RIOTBASE)/,$(APPLICATION_DIRS)) -APPLICATION_DIRS := $(addsuffix /*/Makefile,$(APPLICATION_DIRS)) - # 1. use wildcard to find Makefiles # 2. use patsubst to drop trailing "/" # 3. use patsubst to drop possible leading "./" # 4. sort -APPLICATION_DIRS := $(sort $(patsubst ./%,%,$(patsubst %/,%,$(dir $(wildcard $(APPLICATION_DIRS)))))) +APPLICATION_DIRS := $(addprefix $(RIOTBASE)/,$(APPLICATION_DIRS)) +APPLICATION_DIRS_RELATIVE := $(dir $(wildcard $(addsuffix /*/Makefile,$(APPLICATION_DIRS)))) +APPLICATION_DIRS_ABSOLUTE := $(abspath $(APPLICATION_DIRS_RELATIVE)) +APPLICATION_DIRS := $(sort $(patsubst ./%,%,$(patsubst %/,%,$(APPLICATION_DIRS_RELATIVE)))) info-applications: @for dir in $(APPLICATION_DIRS); do echo $$dir; done From 061c837a016b848082205b769c311966c52da778 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 12 Feb 2021 09:36:55 +0100 Subject: [PATCH 4/5] fixup! makefiles/app_dirs.inc.mk: add examples application subdirs --- makefiles/app_dirs.inc.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefiles/app_dirs.inc.mk b/makefiles/app_dirs.inc.mk index 80c7ebd96a7b..bd6aa9003929 100644 --- a/makefiles/app_dirs.inc.mk +++ b/makefiles/app_dirs.inc.mk @@ -3,7 +3,7 @@ # fallback so empty RIOTBASE won't lead to "/examples/" RIOTBASE ?= . -# Define the list of examples subdirectories that container application directories +# Define the list of examples subdirectories that contain application directories EXAMPLES_APPLICATIONS_SUBDIRS := \ ble \ coap \ From 7ea6ad5d31d62f4588af5a0eaa7556efec7724e1 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Tue, 23 Feb 2021 16:33:03 +0100 Subject: [PATCH 5/5] fixup! makefiles/app_dirs.inc.mk: add examples application subdirs --- makefiles/app_dirs.inc.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefiles/app_dirs.inc.mk b/makefiles/app_dirs.inc.mk index bd6aa9003929..94cdc00fb281 100644 --- a/makefiles/app_dirs.inc.mk +++ b/makefiles/app_dirs.inc.mk @@ -11,7 +11,7 @@ EXAMPLES_APPLICATIONS_SUBDIRS := \ dtls \ gnrc \ icn \ - lora \ + lorawan \ mqtt \ posix \ #