Makefile 3.2 KB
Newer Older
1 2
TARGETS =  bpf
TARGETS += breakpoints
3
TARGETS += capabilities
4
TARGETS += cpufreq
5 6
TARGETS += cpu-hotplug
TARGETS += efivarfs
7 8 9
TARGETS += exec
TARGETS += firmware
TARGETS += ftrace
10
TARGETS += futex
11
TARGETS += gpio
12
TARGETS += intel_pstate
B
Bamvor Jian Zhang 已提交
13
TARGETS += ipc
14
TARGETS += kcmp
K
Kees Cook 已提交
15
TARGETS += lib
16
TARGETS += membarrier
17
TARGETS += memfd
18
TARGETS += memory-hotplug
19
TARGETS += mount
20
TARGETS += mqueue
21
TARGETS += net
22
TARGETS += nsfs
23
TARGETS += powerpc
24
TARGETS += pstore
25
TARGETS += ptrace
K
Kees Cook 已提交
26
TARGETS += seccomp
27
TARGETS += sigaltstack
28
TARGETS += size
29
TARGETS += splice
30
TARGETS += static_keys
31
TARGETS += sync
32
TARGETS += sysctl
S
Shuah Khan 已提交
33
ifneq (1, $(quicktest))
34
TARGETS += timers
S
Shuah Khan 已提交
35
endif
36
TARGETS += user
37
TARGETS += vm
38
TARGETS += x86
39
TARGETS += zram
40
#Please keep the TARGETS list alphabetically sorted
S
Shuah Khan 已提交
41
# Run "make quicktest=1 run_tests" or
42
# "make quicktest=1 kselftest" from top level Makefile
43

44 45 46
TARGETS_HOTPLUG = cpu-hotplug
TARGETS_HOTPLUG += memory-hotplug

47 48 49 50
# 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))
51
override LDFLAGS =
52 53 54
override MAKEFLAGS =
endif

55 56 57 58
ifneq ($(KBUILD_SRC),)
override LDFLAGS =
endif

59 60 61 62 63 64 65 66 67
BUILD := $(O)
ifndef BUILD
  BUILD := $(KBUILD_OUTPUT)
endif
ifndef BUILD
  BUILD := $(shell pwd)
endif

export BUILD
68
all:
69 70 71 72
	for TARGET in $(TARGETS); do		\
		BUILD_TARGET=$$BUILD/$$TARGET;	\
		mkdir $$BUILD_TARGET  -p;	\
		make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
73 74
	done;

75
run_tests: all
76
	for TARGET in $(TARGETS); do \
77 78
		BUILD_TARGET=$$BUILD/$$TARGET;	\
		make OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
79 80
	done;

81 82
hotplug:
	for TARGET in $(TARGETS_HOTPLUG); do \
83 84
		BUILD_TARGET=$$BUILD/$$TARGET;	\
		make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
85 86 87 88
	done;

run_hotplug: hotplug
	for TARGET in $(TARGETS_HOTPLUG); do \
89 90
		BUILD_TARGET=$$BUILD/$$TARGET;	\
		make OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\
91 92 93 94
	done;

clean_hotplug:
	for TARGET in $(TARGETS_HOTPLUG); do \
95 96
		BUILD_TARGET=$$BUILD/$$TARGET;	\
		make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
97 98
	done;

99 100 101
run_pstore_crash:
	make -C pstore run_crash

M
Michael Ellerman 已提交
102 103 104 105 106 107 108 109 110
INSTALL_PATH ?= install
INSTALL_PATH := $(abspath $(INSTALL_PATH))
ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh

install:
ifdef INSTALL_PATH
	@# Ask all targets to install their files
	mkdir -p $(INSTALL_PATH)
	for TARGET in $(TARGETS); do \
111 112
		BUILD_TARGET=$$BUILD/$$TARGET;	\
		make OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
M
Michael Ellerman 已提交
113 114 115
	done;

	@# Ask all targets to emit their test scripts
116
	echo "#!/bin/sh" > $(ALL_SCRIPT)
M
Michael Ellerman 已提交
117 118 119 120
	echo "cd \$$(dirname \$$0)" >> $(ALL_SCRIPT)
	echo "ROOT=\$$PWD" >> $(ALL_SCRIPT)

	for TARGET in $(TARGETS); do \
121
		BUILD_TARGET=$$BUILD/$$TARGET;	\
M
Michael Ellerman 已提交
122 123 124
		echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \
		echo "echo ========================================" >> $(ALL_SCRIPT); \
		echo "cd $$TARGET" >> $(ALL_SCRIPT); \
125
		make -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
M
Michael Ellerman 已提交
126 127 128 129 130 131 132 133
		echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
	done;

	chmod u+x $(ALL_SCRIPT)
else
	$(error Error: set INSTALL_PATH to use install)
endif

134 135
clean:
	for TARGET in $(TARGETS); do \
136 137
		BUILD_TARGET=$$BUILD/$$TARGET;	\
		make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
138
	done;
M
Michael Ellerman 已提交
139

140
.PHONY: all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean