You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/12/04 15:07:18 UTC
(nuttx) 02/02: tools/Unix.mk:Security Checks and Windows Native Compilation Enhancements
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.git
commit eee3af93ffa779625c21dac8ec12ddd0c3f82f2d
Author: chenrun1 <ch...@xiaomi.com>
AuthorDate: Sat Dec 2 12:02:58 2023 +0800
tools/Unix.mk:Security Checks and Windows Native Compilation Enhancements
Avoid splicing paths to /include when BOARD_COMMON_DIR does not exist
and enhanced Windows native compilation
Signed-off-by: chenrun1 <ch...@xiaomi.com>
---
tools/Unix.mk | 4 +++-
tools/Win.mk | 10 +++++++++-
tools/configure.c | 20 +++++++++++++-------
3 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/tools/Unix.mk b/tools/Unix.mk
index d251d0b457..bd8384c03a 100644
--- a/tools/Unix.mk
+++ b/tools/Unix.mk
@@ -283,7 +283,9 @@ include/arch:
LINK_INCLUDE_DIR=$(BOARD_DIR)/include
ifeq ($(wildcard $(LINK_INCLUDE_DIR)),)
- LINK_INCLUDE_DIR = $(BOARD_COMMON_DIR)/include
+ ifneq ($(strip $(BOARD_COMMON_DIR)),)
+ LINK_INCLUDE_DIR = $(BOARD_COMMON_DIR)/include
+ endif
endif
include/arch/board: | include/arch
diff --git a/tools/Win.mk b/tools/Win.mk
index af8b21c7ad..bf14b01caf 100644
--- a/tools/Win.mk
+++ b/tools/Win.mk
@@ -264,10 +264,18 @@ include\arch:
$(Q) $(DIRLINK) $(TOPDIR)\$(ARCH_DIR)\include $@
# Link the boards\<arch>\<chip>\<board>\include directory to include\arch\board
+# If the above path does not exist, then we try to link to common
+
+LINK_INCLUDE_DIR=$(BOARD_DIR)/include
+ifeq ($(wildcard $(LINK_INCLUDE_DIR)),)
+ ifneq ($(strip $(BOARD_COMMON_DIR)),)
+ LINK_INCLUDE_DIR = $(BOARD_COMMON_DIR)/include
+ endif
+endif
include\arch\board: | include\arch
@echo "LN: $@ to $(BOARD_DIR)\include"
- $(Q) $(DIRLINK) $(BOARD_DIR)\include $@
+ $(Q) $(DIRLINK) $(LINK_INCLUDE_DIR) $@
# Link the boards\<arch>\<chip>\common dir to arch\<arch-name>\src\board
# Link the boards\<arch>\<chip>\<board>\src dir to arch\<arch-name>\src\board\board
diff --git a/tools/configure.c b/tools/configure.c
index f18bbae213..b4de9ed37f 100644
--- a/tools/configure.c
+++ b/tools/configure.c
@@ -1121,13 +1121,19 @@ static void check_configuration(void)
debug("check_configuration: Checking %s\n", g_buffer);
if (!verify_file(g_buffer))
{
- fprintf(stderr, "ERROR: No Make.defs file in %s\n",
- g_configpath);
- fprintf(stderr, " No Make.defs file in %s\n",
- g_scriptspath);
- fprintf(stderr, "Run tools/configure -L"
- " to list available configurations.\n");
- exit(EXIT_FAILURE);
+ /* Let’s check if there is a script in the common directory */
+
+ snprintf(g_buffer, BUFFER_SIZE,
+ "%s%c..%c..%c..%ccommon%cscripts%cMake.defs",
+ g_configpath, g_delim, g_delim, g_delim, g_delim,
+ g_delim, g_delim);
+ if (!verify_file(g_buffer))
+ {
+ fprintf(stderr, "ERROR: No Make.defs file found\n");
+ fprintf(stderr, "Run tools/configure -L"
+ " to list available configurations.\n");
+ exit(EXIT_FAILURE);
+ }
}
}
else