Skip to contentSkip to conversation

Makefile: bugfix for handling platform paths

PATCH New Alejandro Cabrera Aldaya 4 participants 4 messages Nov 22, 2022 – Dec 4, 2022 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: bugfix for handling platform paths

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.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 8db6eab..32d4c48 100644
@@ -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
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/1 Makefile: bugfix for handling platform paths

? 2022-11-22???? 12:28 +0200?Alejandro Cabrera Aldaya???

Quoted 15 lines

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.

---
?Makefile | 2 +-
?1 file changed, 1 insertion(+), 1 deletion(-)

Makefile +0 -0
index 8db6eab..32d4c48 100644
@@ -47,7 +47,7 @@ ifdef PLATFORM_DIR
 ???? platform_parent_dir=$(platform_dir_path)
Quoted 5 lines

?? 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}/..)
Quoted 7 lines

?? endif
?else
? platform_parent_dir=$(src_dir)/platform

Signature · 1 line
2.34.1
#2 lore raw

PATCH 1/1 Makefile: bugfix for handling platform paths

Quoted 23 lines · Xiang W

? 2022-11-22???? 12:28 +0200?Alejandro Cabrera Aldaya???

Quoted 15 lines

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.

---
?Makefile | 2 +-
?1 file changed, 1 insertion(+), 1 deletion(-)

Makefile +0 -0
index 8db6eab..32d4c48 100644
@@ -47,7 +47,7 @@ ifdef PLATFORM_DIR
 ???? platform_parent_dir=$(platform_dir_path)
Quoted 5 lines

?? 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.

Quoted 1 line
	platform_parent_dir=$(shell realpath ${platform_dir_path}/..)

I like this simplified version better.

Thanks,
drew

Quoted 17 lines
Quoted 7 lines

?? endif
?else
? platform_parent_dir=$(src_dir)/platform

Signature · 1 line
2.34.1
Signature · 3 lines
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
Applied
#3 lore raw

PATCH 1/1 Makefile: bugfix for handling platform paths

In reply to Xiang W
Quoted 24 lines · Xiang W

? 2022-11-22???? 12:28 +0200?Alejandro Cabrera Aldaya???

Quoted 14 lines

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.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 8db6eab..32d4c48 100644

Makefile ifdef PLATFORM_DIR · line 51

Quoted 6 lines
Makefile +1 -1
@@ -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.

Quoted 3 lines
        platform_parent_dir=$(shell realpath ${platform_dir_path}/..)

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

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 15 lines
Quoted 8 lines
Makefile +0 -0
   endif
 else

platform_parent_dir=$(src_dir)/platform
--
2.34.1

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi