Skip to content

Commit 67d8712

Browse files
author
Shuah Khan
committed
selftests: Fix build failures when invoked from kselftest target
Several tests that rely on implicit build rules fail to build, when invoked from the main Makefile kselftest target. These failures are due to --no-builtin-rules and --no-builtin-variables options set in the inherited MAKEFLAGS. --no-builtin-rules eliminates the use of built-in implicit rules and --no-builtin-variables is for not defining built-in variables. These two options override the use of implicit rules resulting in build failures. In addition, inherited LDFLAGS result in build failures and there is no need to define LDFLAGS. Clear LDFLAGS and MAKEFLAG when make is invoked from the main Makefile kselftest target. Fixing this at selftests Makefile avoids changing the main Makefile and keeps this change self contained at selftests level. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Acked-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 9a0b574 commit 67d8712

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/testing/selftests/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ TARGETS += vm
2222
TARGETS_HOTPLUG = cpu-hotplug
2323
TARGETS_HOTPLUG += memory-hotplug
2424

25+
# Clear LDFLAGS and MAKEFLAGS if called from main
26+
# Makefile to avoid test build failures when test
27+
# Makefile doesn't have explicit build rules.
28+
ifeq (1,$(MAKELEVEL))
29+
undefine LDFLAGS
30+
override MAKEFLAGS =
31+
endif
32+
2533
all:
2634
for TARGET in $(TARGETS); do \
2735
make -C $$TARGET; \

0 commit comments

Comments
 (0)