1# SPDX-License-Identifier: GPL-2.0
2
3# A proper top_srcdir is needed by KSFT(lib.mk)
4top_srcdir = $(realpath ../../../../../)
5
6CFLAGS += $(KHDR_INCLUDES)
7
8TEST_GEN_PROGS := fp-stress \
9	sve-ptrace sve-probe-vls \
10	vec-syscfg \
11	za-fork za-ptrace
12TEST_GEN_PROGS_EXTENDED := fp-pidbench fpsimd-test \
13	rdvl-sme rdvl-sve \
14	sve-test \
15	ssve-test \
16	za-test \
17	zt-ptrace \
18	zt-test \
19	vlset
20TEST_PROGS_EXTENDED := fpsimd-stress sve-stress ssve-stress za-stress
21
22EXTRA_CLEAN += $(OUTPUT)/asm-utils.o $(OUTPUT)/rdvl.o $(OUTPUT)/za-fork-asm.o
23
24# Build with nolibc to avoid effects due to libc's clone() support
25$(OUTPUT)/fp-pidbench: fp-pidbench.S $(OUTPUT)/asm-utils.o
26	$(CC) -nostdlib $^ -o $@
27$(OUTPUT)/fpsimd-test: fpsimd-test.S $(OUTPUT)/asm-utils.o
28	$(CC) -nostdlib $^ -o $@
29$(OUTPUT)/rdvl-sve: rdvl-sve.c $(OUTPUT)/rdvl.o
30$(OUTPUT)/rdvl-sme: rdvl-sme.c $(OUTPUT)/rdvl.o
31$(OUTPUT)/sve-ptrace: sve-ptrace.c
32$(OUTPUT)/sve-probe-vls: sve-probe-vls.c $(OUTPUT)/rdvl.o
33$(OUTPUT)/sve-test: sve-test.S $(OUTPUT)/asm-utils.o
34	$(CC) -nostdlib $^ -o $@
35$(OUTPUT)/ssve-test: sve-test.S $(OUTPUT)/asm-utils.o
36	$(CC) -DSSVE -nostdlib $^ -o $@
37$(OUTPUT)/vec-syscfg: vec-syscfg.c $(OUTPUT)/rdvl.o
38$(OUTPUT)/vlset: vlset.c
39$(OUTPUT)/za-fork: za-fork.c $(OUTPUT)/za-fork-asm.o
40	$(CC) -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib \
41		-include ../../../../include/nolibc/nolibc.h \
42		-static -ffreestanding -Wall $^ -o $@
43$(OUTPUT)/za-ptrace: za-ptrace.c
44$(OUTPUT)/za-test: za-test.S $(OUTPUT)/asm-utils.o
45	$(CC) -nostdlib $^ -o $@
46$(OUTPUT)/zt-ptrace: zt-ptrace.c
47$(OUTPUT)/zt-test: zt-test.S $(OUTPUT)/asm-utils.o
48	$(CC) -nostdlib $^ -o $@
49
50include ../../lib.mk
51