diff mbox series

[07/12] selftests/nolibc: determine $(srctree) first

Message ID 20240728-nolibc-llvm-v1-7-bc384269bc35@weissschuh.net (mailing list archive)
State Accepted
Commit 1a1200b66fd52dca33255270a09a093592c3b877
Headers show
Series tools/nolibc: improve LLVM/clang support | expand

Commit Message

Thomas Weißschuh July 28, 2024, 10:10 a.m. UTC
Avoid needing relative includes.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 tools/testing/selftests/nolibc/Makefile | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Willy Tarreau Aug. 3, 2024, 9:40 a.m. UTC | #1
On Sun, Jul 28, 2024 at 12:10:01PM +0200, Thomas Weißschuh wrote:
> Avoid needing relative includes.

I'm not opposed, but what's the benefit ? IMHO relative paths are
generally more flexible and robust. you could imagine a completely
made up example in which you have a symlink to selftests/nolibc in
your home dir, which works perfectly with relative paths when you
cd into it while it would not anymore with absolute paths (unless
you use cd -P).

Thus if we are decided to lose that flexibility at least it should
be argumented in the commit message.

Thanks,
Willy
Thomas Weißschuh Aug. 4, 2024, 3:55 p.m. UTC | #2
On 2024-08-03 11:40:24+0000, Willy Tarreau wrote:
> On Sun, Jul 28, 2024 at 12:10:01PM +0200, Thomas Weißschuh wrote:
> > Avoid needing relative includes.
> 
> I'm not opposed, but what's the benefit ? IMHO relative paths are
> generally more flexible and robust. you could imagine a completely
> made up example in which you have a symlink to selftests/nolibc in
> your home dir, which works perfectly with relative paths when you
> cd into it while it would not anymore with absolute paths (unless
> you use cd -P).

This commit is solely about relative includes in the nolibc-test
Makefile.
The actual code is unaffected.

include ../../../scripts/utilities.mak
->
include $(srctree)/tools/scripts/utilities.mak

This commit is not necessary, just a cleanup.
IMO consistently using $(srctree) is nicer.

And yes the message for this commit is really not great.

> Thus if we are decided to lose that flexibility at least it should
> be argumented in the commit message.
> 
> Thanks,
> Willy
diff mbox series

Patch

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 46dfbb50fae5..803a4e1bbe24 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -1,9 +1,14 @@ 
 # SPDX-License-Identifier: GPL-2.0
 # Makefile for nolibc tests
-include ../../../scripts/Makefile.include
-include ../../../scripts/utilities.mak
+# we're in ".../tools/testing/selftests/nolibc"
+ifeq ($(srctree),)
+srctree := $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR)))
+endif
+
+include $(srctree)/tools/scripts/Makefile.include
+include $(srctree)/tools/scripts/utilities.mak
 # We need this for the "cc-option" macro.
-include ../../../build/Build.include
+include $(srctree)/tools/build/Build.include
 
 ifneq ($(O),)
 ifneq ($(call is-absolute,$(O)),y)
@@ -11,11 +16,6 @@  $(error Only absolute O= parameters are supported)
 endif
 endif
 
-# we're in ".../tools/testing/selftests/nolibc"
-ifeq ($(srctree),)
-srctree := $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR)))
-endif
-
 ifeq ($(ARCH),)
 include $(srctree)/scripts/subarch.include
 ARCH = $(SUBARCH)