Makefile 3.1 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 42
# Run "make quicktest=1 run_tests" or
# "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 59 60 61 62 63
BUILD := $(O)
ifndef BUILD
  BUILD := $(KBUILD_OUTPUT)
endif
ifndef BUILD
  BUILD := $(shell pwd)
endif

export BUILD
64
all:
65 66 67 68
	for TARGET in $(TARGETS); do		\
		BUILD_TARGET=$$BUILD/$$TARGET;	\
		mkdir $$BUILD_TARGET  -p;	\
		make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
69 70
	done;

71
run_tests: all
72
	for TARGET in $(TARGETS); do \
73 74
		BUILD_TARGET=$$BUILD/$$TARGET;	\
		make OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
75 76
	done;

77 78
hotplug:
	for TARGET in $(TARGETS_HOTPLUG); do \
79 80
		BUILD_TARGET=$$BUILD/$$TARGET;	\
		make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
81 82 83 84
	done;

run_hotplug: hotplug
	for TARGET in $(TARGETS_HOTPLUG); do \
85 86
		BUILD_TARGET=$$BUILD/$$TARGET;	\
		make OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\
87 88 89 90
	done;

clean_hotplug:
	for TARGET in $(TARGETS_HOTPLUG); do \
91 92
		BUILD_TARGET=$$BUILD/$$TARGET;	\
		make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
93 94
	done;

95 96 97
run_pstore_crash:
	make -C pstore run_crash

M
Michael Ellerman 已提交
98 99 100 101 102 103 104 105 106
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 \
107 108
		BUILD_TARGET=$$BUILD/$$TARGET;	\
		make OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
M
Michael Ellerman 已提交
109 110 111
	done;

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

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

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

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

.PHONY: install