[PATCH v2 17/30] Kbuild: Detect including an MSYS2 path
Simon Glass
sjg at chromium.org
Sun Apr 30 03:29:50 CEST 2023
The source-tree directory is prepended to relative include paths, but this
does not work on Windows, where a path may have a drive letter like C: at
the start of it.
This breaks SDL which includes an absolute path to the header directory to
the C flags, e.g. -IC:/msys64/mingw64/include/SDL2
Add this as a special case to leave these absolute paths alone on Windows.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
(no changes since v1)
scripts/Kbuild.include | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 62e0207f91b4..411a768a7767 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -205,9 +205,10 @@ clean := -f $(srctree)/scripts/Makefile.clean obj
hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
# Prefix -I with $(srctree) if it is not an absolute path.
+# Detect C: (C drive) with MSYS2
# skip if -I has no parameter
addtree = $(if $(patsubst -I%,%,$(1)), \
-$(if $(filter-out -I/% -I./% -I../%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1)),$(1))
+$(if $(filter-out -I/% -I./% -I../% -IC:%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1)),$(1))
# Find all -I options and call addtree
flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
--
2.40.1.495.gc816e09b53d-goog
More information about the U-Boot
mailing list