1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
270b574e7SDominik Brodowskiinclude ../lib.mk
370b574e7SDominik Brodowski
429ee9239SShuah Khan (Samsung OSG)uname_M := $(shell uname -m 2>/dev/null || echo not)
529ee9239SShuah Khan (Samsung OSG)ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
629ee9239SShuah Khan (Samsung OSG)
72e9a9725SMark BrownTEST_GEN_PROGS := $(OUTPUT)/vdso_test_gettimeofday $(OUTPUT)/vdso_test_getcpu
8693f5ca0SVincenzo FrascinoTEST_GEN_PROGS += $(OUTPUT)/vdso_test_abi
903f55c79SVincenzo FrascinoTEST_GEN_PROGS += $(OUTPUT)/vdso_test_clock_getres
10*c7e5789bSVincenzo Frascinoifeq ($(ARCH),$(filter $(ARCH),x86 x86_64))
1129ee9239SShuah Khan (Samsung OSG)TEST_GEN_PROGS += $(OUTPUT)/vdso_standalone_test_x86
1229ee9239SShuah Khan (Samsung OSG)endif
13*c7e5789bSVincenzo FrascinoTEST_GEN_PROGS += $(OUTPUT)/vdso_test_correctness
1429ee9239SShuah Khan (Samsung OSG)
15f9b6b0efSShuah KhanCFLAGS := -std=gnu99
16f9b6b0efSShuah KhanCFLAGS_vdso_standalone_test_x86 := -nostdlib -fno-asynchronous-unwind-tables -fno-stack-protector
17*c7e5789bSVincenzo FrascinoLDFLAGS_vdso_test_correctness := -ldl
18f9b6b0efSShuah Khanifeq ($(CONFIG_X86_32),y)
19f9b6b0efSShuah KhanLDLIBS += -lgcc_s
20f9b6b0efSShuah Khanendif
21f9b6b0efSShuah Khan
2229ee9239SShuah Khan (Samsung OSG)all: $(TEST_GEN_PROGS)
23babf8a97SMark Brown$(OUTPUT)/vdso_test_gettimeofday: parse_vdso.c vdso_test_gettimeofday.c
242e9a9725SMark Brown$(OUTPUT)/vdso_test_getcpu: parse_vdso.c vdso_test_getcpu.c
25693f5ca0SVincenzo Frascino$(OUTPUT)/vdso_test_abi: parse_vdso.c vdso_test_abi.c
2603f55c79SVincenzo Frascino$(OUTPUT)/vdso_test_clock_getres: vdso_test_clock_getres.c
2770b574e7SDominik Brodowski$(OUTPUT)/vdso_standalone_test_x86: vdso_standalone_test_x86.c parse_vdso.c
28f9b6b0efSShuah Khan	$(CC) $(CFLAGS) $(CFLAGS_vdso_standalone_test_x86) \
29f9b6b0efSShuah Khan		vdso_standalone_test_x86.c parse_vdso.c \
3070b574e7SDominik Brodowski		-o $@
31*c7e5789bSVincenzo Frascino$(OUTPUT)/vdso_test_correctness: vdso_test_correctness.c
32*c7e5789bSVincenzo Frascino	$(CC) $(CFLAGS) \
33*c7e5789bSVincenzo Frascino		vdso_test_correctness.c \
34*c7e5789bSVincenzo Frascino		-o $@ \
35*c7e5789bSVincenzo Frascino		$(LDFLAGS_vdso_test_correctness)
36