whiterose

linux unikernel
Log | Files | Refs | README | LICENSE | git clone https://git.ne02ptzero.me/git/whiterose

Makefile (4632B)


      1 # SPDX-License-Identifier: GPL-2.0
      2 TARGETS = android
      3 TARGETS += bpf
      4 TARGETS += breakpoints
      5 TARGETS += capabilities
      6 TARGETS += cgroup
      7 TARGETS += cpufreq
      8 TARGETS += cpu-hotplug
      9 TARGETS += drivers/dma-buf
     10 TARGETS += efivarfs
     11 TARGETS += exec
     12 TARGETS += filesystems
     13 TARGETS += filesystems/binderfs
     14 TARGETS += firmware
     15 TARGETS += ftrace
     16 TARGETS += futex
     17 TARGETS += gpio
     18 TARGETS += ima
     19 TARGETS += intel_pstate
     20 TARGETS += ipc
     21 TARGETS += ir
     22 TARGETS += kcmp
     23 TARGETS += kvm
     24 TARGETS += lib
     25 TARGETS += livepatch
     26 TARGETS += membarrier
     27 TARGETS += memfd
     28 TARGETS += memory-hotplug
     29 TARGETS += mount
     30 TARGETS += mqueue
     31 TARGETS += net
     32 TARGETS += netfilter
     33 TARGETS += networking/timestamping
     34 TARGETS += nsfs
     35 TARGETS += pidfd
     36 TARGETS += powerpc
     37 TARGETS += proc
     38 TARGETS += pstore
     39 TARGETS += ptrace
     40 TARGETS += rseq
     41 TARGETS += rtc
     42 TARGETS += seccomp
     43 TARGETS += sigaltstack
     44 TARGETS += size
     45 TARGETS += sparc64
     46 TARGETS += splice
     47 TARGETS += static_keys
     48 TARGETS += sync
     49 TARGETS += sysctl
     50 ifneq (1, $(quicktest))
     51 TARGETS += timers
     52 endif
     53 TARGETS += tmpfs
     54 TARGETS += tpm2
     55 TARGETS += user
     56 TARGETS += vm
     57 TARGETS += x86
     58 TARGETS += zram
     59 #Please keep the TARGETS list alphabetically sorted
     60 # Run "make quicktest=1 run_tests" or
     61 # "make quicktest=1 kselftest" from top level Makefile
     62 
     63 TARGETS_HOTPLUG = cpu-hotplug
     64 TARGETS_HOTPLUG += memory-hotplug
     65 
     66 # Clear LDFLAGS and MAKEFLAGS if called from main
     67 # Makefile to avoid test build failures when test
     68 # Makefile doesn't have explicit build rules.
     69 ifeq (1,$(MAKELEVEL))
     70 override LDFLAGS =
     71 override MAKEFLAGS =
     72 endif
     73 
     74 ifneq ($(KBUILD_SRC),)
     75 override LDFLAGS =
     76 endif
     77 
     78 BUILD := $(O)
     79 ifndef BUILD
     80   BUILD := $(KBUILD_OUTPUT)
     81 endif
     82 ifndef BUILD
     83   BUILD := $(shell pwd)
     84 endif
     85 
     86 # KSFT_TAP_LEVEL is used from KSFT framework to prevent nested TAP header
     87 # printing from tests. Applicable to run_tests case where run_tests adds
     88 # TAP header prior running tests and when a test program invokes another
     89 # with system() call. Export it here to cover override RUN_TESTS defines.
     90 export KSFT_TAP_LEVEL=`echo 1`
     91 
     92 export BUILD
     93 all:
     94 	@for TARGET in $(TARGETS); do		\
     95 		BUILD_TARGET=$$BUILD/$$TARGET;	\
     96 		mkdir $$BUILD_TARGET  -p;	\
     97 		make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
     98 	done;
     99 
    100 run_tests: all
    101 	@for TARGET in $(TARGETS); do \
    102 		BUILD_TARGET=$$BUILD/$$TARGET;	\
    103 		make OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
    104 	done;
    105 
    106 hotplug:
    107 	@for TARGET in $(TARGETS_HOTPLUG); do \
    108 		BUILD_TARGET=$$BUILD/$$TARGET;	\
    109 		make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
    110 	done;
    111 
    112 run_hotplug: hotplug
    113 	@for TARGET in $(TARGETS_HOTPLUG); do \
    114 		BUILD_TARGET=$$BUILD/$$TARGET;	\
    115 		make OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\
    116 	done;
    117 
    118 clean_hotplug:
    119 	@for TARGET in $(TARGETS_HOTPLUG); do \
    120 		BUILD_TARGET=$$BUILD/$$TARGET;	\
    121 		make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
    122 	done;
    123 
    124 run_pstore_crash:
    125 	make -C pstore run_crash
    126 
    127 INSTALL_PATH ?= install
    128 INSTALL_PATH := $(abspath $(INSTALL_PATH))
    129 ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh
    130 
    131 install:
    132 ifdef INSTALL_PATH
    133 	@# Ask all targets to install their files
    134 	mkdir -p $(INSTALL_PATH)
    135 	@for TARGET in $(TARGETS); do \
    136 		BUILD_TARGET=$$BUILD/$$TARGET;	\
    137 		make OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
    138 	done;
    139 
    140 	@# Ask all targets to emit their test scripts
    141 	echo "#!/bin/sh" > $(ALL_SCRIPT)
    142 	echo "BASE_DIR=\$$(realpath \$$(dirname \$$0))" >> $(ALL_SCRIPT)
    143 	echo "cd \$$BASE_DIR" >> $(ALL_SCRIPT)
    144 	echo "ROOT=\$$PWD" >> $(ALL_SCRIPT)
    145 	echo "if [ \"\$$1\" = \"--summary\" ]; then" >> $(ALL_SCRIPT)
    146 	echo "  OUTPUT=\$$BASE_DIR/output.log" >> $(ALL_SCRIPT)
    147 	echo "  cat /dev/null > \$$OUTPUT" >> $(ALL_SCRIPT)
    148 	echo "else" >> $(ALL_SCRIPT)
    149 	echo "  OUTPUT=/dev/stdout" >> $(ALL_SCRIPT)
    150 	echo "fi" >> $(ALL_SCRIPT)
    151 	echo "export KSFT_TAP_LEVEL=1" >> $(ALL_SCRIPT)
    152 	echo "export skip=4" >> $(ALL_SCRIPT)
    153 
    154 	for TARGET in $(TARGETS); do \
    155 		BUILD_TARGET=$$BUILD/$$TARGET;	\
    156 		echo "echo ; echo TAP version 13" >> $(ALL_SCRIPT);	\
    157 		echo "echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \
    158 		echo "echo ========================================" >> $(ALL_SCRIPT); \
    159 		echo "[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT); \
    160 		echo "cd $$TARGET" >> $(ALL_SCRIPT); \
    161 		make -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
    162 		echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
    163 	done;
    164 
    165 	chmod u+x $(ALL_SCRIPT)
    166 else
    167 	$(error Error: set INSTALL_PATH to use install)
    168 endif
    169 
    170 clean:
    171 	@for TARGET in $(TARGETS); do \
    172 		BUILD_TARGET=$$BUILD/$$TARGET;	\
    173 		make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
    174 	done;
    175 
    176 .PHONY: all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean