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

42 43 44
TARGETS_HOTPLUG = cpu-hotplug
TARGETS_HOTPLUG += memory-hotplug

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

53 54 55 56 57 58 59 60 61
BUILD := $(O)
ifndef BUILD
  BUILD := $(KBUILD_OUTPUT)
endif
ifndef BUILD
  BUILD := $(shell pwd)
endif

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

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

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

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

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

93 94 95
run_pstore_crash:
	make -C pstore run_crash

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

	@# Ask all targets to emit their test scripts
	echo "#!/bin/bash" > $(ALL_SCRIPT)
	echo "cd \$$(dirname \$$0)" >> $(ALL_SCRIPT)
	echo "ROOT=\$$PWD" >> $(ALL_SCRIPT)

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

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

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

.PHONY: install