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	vlset
18TEST_PROGS_EXTENDED := fpsimd-stress sve-stress ssve-stress za-stress
19
20EXTRA_CLEAN += $(OUTPUT)/asm-utils.o $(OUTPUT)/rdvl.o $(OUTPUT)/za-fork-asm.o
21
22# Build with nolibc to avoid effects due to libc's clone() support
23$(OUTPUT)/fp-pidbench: fp-pidbench.S $(OUTPUT)/asm-utils.o
24	$(CC) -nostdlib $^ -o $@
25$(OUTPUT)/fpsimd-test: fpsimd-test.S $(OUTPUT)/asm-utils.o
26	$(CC) -nostdlib $^ -o $@
27$(OUTPUT)/rdvl-sve: rdvl-sve.c $(OUTPUT)/rdvl.o
28$(OUTPUT)/rdvl-sme: rdvl-sme.c $(OUTPUT)/rdvl.o
29$(OUTPUT)/sve-ptrace: sve-ptrace.c
30$(OUTPUT)/sve-probe-vls: sve-probe-vls.c $(OUTPUT)/rdvl.o
31$(OUTPUT)/sve-test: sve-test.S $(OUTPUT)/asm-utils.o
32	$(CC) -nostdlib $^ -o $@
33$(OUTPUT)/ssve-test: sve-test.S $(OUTPUT)/asm-utils.o
34	$(CC) -DSSVE -nostdlib $^ -o $@
35$(OUTPUT)/vec-syscfg: vec-syscfg.c $(OUTPUT)/rdvl.o
36$(OUTPUT)/vlset: vlset.c
37$(OUTPUT)/za-fork: za-fork.c $(OUTPUT)/za-fork-asm.o
38	$(CC) -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib \
39		-include ../../../../include/nolibc/nolibc.h \
40		-static -ffreestanding -Wall $^ -o $@
41$(OUTPUT)/za-ptrace: za-ptrace.c
42$(OUTPUT)/za-test: za-test.S $(OUTPUT)/asm-utils.o
43	$(CC) -nostdlib $^ -o $@
44
45include ../../lib.mk
46