Skip to content

Commit b25c528

Browse files
wtarreaupaulmckrcu
authored andcommitted
selftests/nolibc: "sysroot" target installs a local copy of the sysroot
It's not convenient to rely on a sysroot built in another directory, especially when running cross-compilation tests, where one has to switch back and forth between directories. Let's make it possible to install the sysroot directly in the test directory. It's not big and even benefits from being copied by arch so that it's easier to switch between archs if needed. The new "sysroot" target does this, it just calls "headers_standalone" from nolibc to install the sysroot right here. Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 662ea60 commit b25c528

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tools/testing/selftests/nolibc/Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,16 @@ LDFLAGS := -s
6767

6868
all: nolibc-test
6969

70-
nolibc-test: nolibc-test.c
70+
sysroot: sysroot/$(ARCH)/include
71+
72+
sysroot/$(ARCH)/include:
73+
$(QUIET_MKDIR)mkdir -p sysroot
74+
$(Q)$(MAKE) -C ../../../include/nolibc ARCH=$(ARCH) OUTPUT=$(CURDIR)/sysroot/ headers_standalone
75+
$(Q)mv sysroot/sysroot sysroot/$(ARCH)
76+
77+
nolibc-test: nolibc-test.c sysroot/$(ARCH)/include
7178
$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ \
72-
-nostdlib -static -include ../../../include/nolibc/nolibc.h $^ -lgcc
79+
-nostdlib -static -Isysroot/$(ARCH)/include $< -lgcc
7380

7481
initramfs: nolibc-test
7582
$(QUIET_MKDIR)mkdir -p initramfs
@@ -93,6 +100,8 @@ rerun:
93100
$(Q)grep -w FAIL "$(CURDIR)/run.out" && echo "See all results in $(CURDIR)/run.out" || echo "$$(grep -c ^[0-9].*OK $(CURDIR)/run.out) test(s) passed."
94101

95102
clean:
103+
$(call QUIET_CLEAN, sysroot)
104+
$(Q)rm -rf sysroot
96105
$(call QUIET_CLEAN, nolibc-test)
97106
$(Q)rm -f nolibc-test
98107
$(call QUIET_CLEAN, initramfs)

0 commit comments

Comments
 (0)