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