[PATCH v2 17/30] Kbuild: Detect including an MSYS2 path

Tom Rini trini at konsulko.com
Sun Apr 30 16:29:10 CEST 2023


On Sat, Apr 29, 2023 at 07:29:50PM -0600, Simon Glass wrote:
> 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)))

This feels a bit fragile, stuff could be on some network drive instead
and so another letter, can we make this a bit more generic?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230430/220281ac/attachment.sig>


More information about the U-Boot mailing list