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 <chenrun1@xiaomi.com>
This commit is contained in:
chenrun1
2023-12-02 12:02:58 +08:00
committed by Xiang Xiao
parent e4b561d51b
commit eee3af93ff
3 changed files with 25 additions and 9 deletions
+2
View File
@@ -283,8 +283,10 @@ include/arch:
LINK_INCLUDE_DIR=$(BOARD_DIR)/include LINK_INCLUDE_DIR=$(BOARD_DIR)/include
ifeq ($(wildcard $(LINK_INCLUDE_DIR)),) ifeq ($(wildcard $(LINK_INCLUDE_DIR)),)
ifneq ($(strip $(BOARD_COMMON_DIR)),)
LINK_INCLUDE_DIR = $(BOARD_COMMON_DIR)/include LINK_INCLUDE_DIR = $(BOARD_COMMON_DIR)/include
endif endif
endif
include/arch/board: | include/arch include/arch/board: | include/arch
@echo "LN: $@ to $(BOARD_DIR)/include" @echo "LN: $@ to $(BOARD_DIR)/include"
+9 -1
View File
@@ -264,10 +264,18 @@ include\arch:
$(Q) $(DIRLINK) $(TOPDIR)\$(ARCH_DIR)\include $@ $(Q) $(DIRLINK) $(TOPDIR)\$(ARCH_DIR)\include $@
# Link the boards\<arch>\<chip>\<board>\include directory to include\arch\board # 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 include\arch\board: | include\arch
@echo "LN: $@ to $(BOARD_DIR)\include" @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>\common dir to arch\<arch-name>\src\board
# Link the boards\<arch>\<chip>\<board>\src dir to arch\<arch-name>\src\board\board # Link the boards\<arch>\<chip>\<board>\src dir to arch\<arch-name>\src\board\board
+10 -4
View File
@@ -1121,15 +1121,21 @@ static void check_configuration(void)
debug("check_configuration: Checking %s\n", g_buffer); debug("check_configuration: Checking %s\n", g_buffer);
if (!verify_file(g_buffer)) if (!verify_file(g_buffer))
{ {
fprintf(stderr, "ERROR: No Make.defs file in %s\n", /* Lets check if there is a script in the common directory */
g_configpath);
fprintf(stderr, " No Make.defs file in %s\n", snprintf(g_buffer, BUFFER_SIZE,
g_scriptspath); "%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" fprintf(stderr, "Run tools/configure -L"
" to list available configurations.\n"); " to list available configurations.\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
}
else else
{ {
fprintf(stderr, "ERROR: No Make.defs file in %s\n", g_configpath); fprintf(stderr, "ERROR: No Make.defs file in %s\n", g_configpath);