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