diff mbox series

Makefile: bugfix for handling platform paths

Message ID 20221122102825.88440-1-aldaya@gmail.com
State Accepted
Headers show
Series Makefile: bugfix for handling platform paths | expand

Commit Message

Alejandro Cabrera Aldaya Nov. 22, 2022, 10:28 a.m. UTC
If the path where this repo is located contains the platform name on it,
the original Makefile replaced its occurrences from the path making it an invalid path.
This commit prevents this behavior replacing only the last part of the path as intended.

Signed-off-by: Alejandro Cabrera Aldaya <aldaya@gmail.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Xiang W Nov. 22, 2022, 1:42 p.m. UTC | #1
在 2022-11-22星期二的 12:28 +0200,Alejandro Cabrera Aldaya写道:
> If the path where this repo is located contains the platform name on it,
> the original Makefile replaced its occurrences from the path making it an invalid path.
> This commit prevents this behavior replacing only the last part of the path as intended.
> 
> Signed-off-by: Alejandro Cabrera Aldaya <aldaya@gmail.com>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 8db6eab..32d4c48 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -47,7 +47,7 @@ ifdef PLATFORM_DIR
>      platform_parent_dir=$(platform_dir_path)
>    else
>      PLATFORM=$(shell basename $(platform_dir_path))
> -    platform_parent_dir=$(subst $(PLATFORM),,$(platform_dir_path))
> +    platform_parent_dir=$(shell dirname $(shell realpath $(platform_dir_path)))    
> 

Looks good, could simplify it a bit.
	platform_parent_dir=$(shell realpath ${platform_dir_path}/..)

Reviewed-by: Xiang W <wxjstz@126.com>

>    endif
>  else
>   platform_parent_dir=$(src_dir)/platform
> -- 
> 2.34.1
> 
>
Andrew Jones Nov. 22, 2022, 5:29 p.m. UTC | #2
On Tue, Nov 22, 2022 at 09:42:38PM +0800, Xiang W wrote:
> 在 2022-11-22星期二的 12:28 +0200,Alejandro Cabrera Aldaya写道:
> > If the path where this repo is located contains the platform name on it,
> > the original Makefile replaced its occurrences from the path making it an invalid path.
> > This commit prevents this behavior replacing only the last part of the path as intended.
> > 
> > Signed-off-by: Alejandro Cabrera Aldaya <aldaya@gmail.com>
> > ---
> >  Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index 8db6eab..32d4c48 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -47,7 +47,7 @@ ifdef PLATFORM_DIR
> >      platform_parent_dir=$(platform_dir_path)
> >    else
> >      PLATFORM=$(shell basename $(platform_dir_path))
> > -    platform_parent_dir=$(subst $(PLATFORM),,$(platform_dir_path))
> > +    platform_parent_dir=$(shell dirname $(shell realpath $(platform_dir_path)))    
> > 
> 
> Looks good, could simplify it a bit.
> 	platform_parent_dir=$(shell realpath ${platform_dir_path}/..)

I like this simplified version better.

Reviewed-by: Andrew Jones <ajones@ventanamicro.com>

Thanks,
drew

> 
> Reviewed-by: Xiang W <wxjstz@126.com>
> 
> >    endif
> >  else
> >   platform_parent_dir=$(src_dir)/platform
> > -- 
> > 2.34.1
> > 
> > 
> 
> 
> 
> -- 
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
Anup Patel Dec. 4, 2022, 3:32 p.m. UTC | #3
On Tue, Nov 22, 2022 at 7:12 PM Xiang W <wxjstz@126.com> wrote:
>
> 在 2022-11-22星期二的 12:28 +0200,Alejandro Cabrera Aldaya写道:
> > If the path where this repo is located contains the platform name on it,
> > the original Makefile replaced its occurrences from the path making it an invalid path.
> > This commit prevents this behavior replacing only the last part of the path as intended.
> >
> > Signed-off-by: Alejandro Cabrera Aldaya <aldaya@gmail.com>
> > ---
> >  Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 8db6eab..32d4c48 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -47,7 +47,7 @@ ifdef PLATFORM_DIR
> >      platform_parent_dir=$(platform_dir_path)
> >    else
> >      PLATFORM=$(shell basename $(platform_dir_path))
> > -    platform_parent_dir=$(subst $(PLATFORM),,$(platform_dir_path))
> > +    platform_parent_dir=$(shell dirname $(shell realpath $(platform_dir_path)))
> >
>
> Looks good, could simplify it a bit.
>         platform_parent_dir=$(shell realpath ${platform_dir_path}/..)
>
> Reviewed-by: Xiang W <wxjstz@126.com>

I have considered the simplified version at the time of merging
this patch.

Reviewed-by: Anup Patel <anup@brainfaul.torg>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

>
> >    endif
> >  else
> >   platform_parent_dir=$(src_dir)/platform
> > --
> > 2.34.1
> >
> >
>
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 8db6eab..32d4c48 100644
--- a/Makefile
+++ b/Makefile
@@ -47,7 +47,7 @@  ifdef PLATFORM_DIR
     platform_parent_dir=$(platform_dir_path)
   else
     PLATFORM=$(shell basename $(platform_dir_path))
-    platform_parent_dir=$(subst $(PLATFORM),,$(platform_dir_path))
+    platform_parent_dir=$(shell dirname $(shell realpath $(platform_dir_path)))    
   endif
 else
  platform_parent_dir=$(src_dir)/platform