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

Bin Meng bmeng.cn at gmail.com
Mon May 1 11:20:31 CEST 2023


Hi Simon,

On Sun, Apr 30, 2023 at 9:30 AM Simon Glass <sjg at chromium.org> 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))

What happens if MSYS2 is not installed to the C drive?

>
>  # Find all -I options and call addtree
>  flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
> --

Regards,
Bin


More information about the U-Boot mailing list