1TARGETS = breakpoints 2TARGETS += cpu-hotplug 3TARGETS += efivarfs 4TARGETS += exec 5TARGETS += firmware 6TARGETS += ftrace 7TARGETS += kcmp 8TARGETS += memfd 9TARGETS += memory-hotplug 10TARGETS += mount 11TARGETS += mqueue 12TARGETS += net 13TARGETS += powerpc 14TARGETS += ptrace 15TARGETS += size 16TARGETS += sysctl 17TARGETS += timers 18TARGETS += user 19TARGETS += vm 20TARGETS += x86 21#Please keep the TARGETS list alphabetically sorted 22 23TARGETS_HOTPLUG = cpu-hotplug 24TARGETS_HOTPLUG += memory-hotplug 25 26# Clear LDFLAGS and MAKEFLAGS if called from main 27# Makefile to avoid test build failures when test 28# Makefile doesn't have explicit build rules. 29ifeq (1,$(MAKELEVEL)) 30undefine LDFLAGS 31override MAKEFLAGS = 32endif 33 34all: 35 for TARGET in $(TARGETS); do \ 36 make -C $$TARGET; \ 37 done; 38 39run_tests: all 40 for TARGET in $(TARGETS); do \ 41 make -C $$TARGET run_tests; \ 42 done; 43 44hotplug: 45 for TARGET in $(TARGETS_HOTPLUG); do \ 46 make -C $$TARGET; \ 47 done; 48 49run_hotplug: hotplug 50 for TARGET in $(TARGETS_HOTPLUG); do \ 51 make -C $$TARGET run_full_test; \ 52 done; 53 54clean_hotplug: 55 for TARGET in $(TARGETS_HOTPLUG); do \ 56 make -C $$TARGET clean; \ 57 done; 58 59INSTALL_PATH ?= install 60INSTALL_PATH := $(abspath $(INSTALL_PATH)) 61ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh 62 63install: 64ifdef INSTALL_PATH 65 @# Ask all targets to install their files 66 mkdir -p $(INSTALL_PATH) 67 for TARGET in $(TARGETS); do \ 68 mkdir -p $(INSTALL_PATH)/$$TARGET ; \ 69 make -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \ 70 done; 71 72 @# Ask all targets to emit their test scripts 73 echo "#!/bin/bash" > $(ALL_SCRIPT) 74 echo "cd \$$(dirname \$$0)" >> $(ALL_SCRIPT) 75 echo "ROOT=\$$PWD" >> $(ALL_SCRIPT) 76 77 for TARGET in $(TARGETS); do \ 78 echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \ 79 echo "echo ========================================" >> $(ALL_SCRIPT); \ 80 echo "cd $$TARGET" >> $(ALL_SCRIPT); \ 81 make -s --no-print-directory -C $$TARGET emit_tests >> $(ALL_SCRIPT); \ 82 echo "cd \$$ROOT" >> $(ALL_SCRIPT); \ 83 done; 84 85 chmod u+x $(ALL_SCRIPT) 86else 87 $(error Error: set INSTALL_PATH to use install) 88endif 89 90clean: 91 for TARGET in $(TARGETS); do \ 92 make -C $$TARGET clean; \ 93 done; 94 95.PHONY: install 96