162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ciinclude ../lib.mk
362306a36Sopenharmony_ci
462306a36Sopenharmony_ciuname_M := $(shell uname -m 2>/dev/null || echo not)
562306a36Sopenharmony_ciARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciTEST_GEN_PROGS := $(OUTPUT)/vdso_test_gettimeofday $(OUTPUT)/vdso_test_getcpu
862306a36Sopenharmony_ciTEST_GEN_PROGS += $(OUTPUT)/vdso_test_abi
962306a36Sopenharmony_ciTEST_GEN_PROGS += $(OUTPUT)/vdso_test_clock_getres
1062306a36Sopenharmony_ciifeq ($(ARCH),$(filter $(ARCH),x86 x86_64))
1162306a36Sopenharmony_ciTEST_GEN_PROGS += $(OUTPUT)/vdso_standalone_test_x86
1262306a36Sopenharmony_ciendif
1362306a36Sopenharmony_ciTEST_GEN_PROGS += $(OUTPUT)/vdso_test_correctness
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciCFLAGS := -std=gnu99
1662306a36Sopenharmony_ciCFLAGS_vdso_standalone_test_x86 := -nostdlib -fno-asynchronous-unwind-tables -fno-stack-protector
1762306a36Sopenharmony_ciLDFLAGS_vdso_test_correctness := -ldl
1862306a36Sopenharmony_ciifeq ($(CONFIG_X86_32),y)
1962306a36Sopenharmony_ciLDLIBS += -lgcc_s
2062306a36Sopenharmony_ciendif
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ciall: $(TEST_GEN_PROGS)
2362306a36Sopenharmony_ci$(OUTPUT)/vdso_test_gettimeofday: parse_vdso.c vdso_test_gettimeofday.c
2462306a36Sopenharmony_ci$(OUTPUT)/vdso_test_getcpu: parse_vdso.c vdso_test_getcpu.c
2562306a36Sopenharmony_ci$(OUTPUT)/vdso_test_abi: parse_vdso.c vdso_test_abi.c
2662306a36Sopenharmony_ci$(OUTPUT)/vdso_test_clock_getres: vdso_test_clock_getres.c
2762306a36Sopenharmony_ci$(OUTPUT)/vdso_standalone_test_x86: vdso_standalone_test_x86.c parse_vdso.c
2862306a36Sopenharmony_ci	$(CC) $(CFLAGS) $(CFLAGS_vdso_standalone_test_x86) \
2962306a36Sopenharmony_ci		vdso_standalone_test_x86.c parse_vdso.c \
3062306a36Sopenharmony_ci		-o $@
3162306a36Sopenharmony_ci$(OUTPUT)/vdso_test_correctness: vdso_test_correctness.c
3262306a36Sopenharmony_ci	$(CC) $(CFLAGS) \
3362306a36Sopenharmony_ci		vdso_test_correctness.c \
3462306a36Sopenharmony_ci		-o $@ \
3562306a36Sopenharmony_ci		$(LDFLAGS_vdso_test_correctness)
36