Skip to content

Commit

Permalink
selftests: Fix build failures when invoked from kselftest target
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Michael Ellerman <[email protected]>
  • Loading branch information
Shuah Khan committed Mar 19, 2015
1 parent 9a0b574 commit 67d8712
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/testing/selftests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ TARGETS += vm
TARGETS_HOTPLUG = cpu-hotplug
TARGETS_HOTPLUG += memory-hotplug

# Clear LDFLAGS and MAKEFLAGS if called from main
# Makefile to avoid test build failures when test
# Makefile doesn't have explicit build rules.
ifeq (1,$(MAKELEVEL))
undefine LDFLAGS
override MAKEFLAGS =
endif

all:
for TARGET in $(TARGETS); do \
make -C $$TARGET; \
Expand Down

0 comments on commit 67d8712

Please sign in to comment.