xref: /OK3568_Linux_fs/kernel/tools/testing/selftests/vDSO/Makefile (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyuninclude ../lib.mk
3*4882a593Smuzhiyun
4*4882a593Smuzhiyununame_M := $(shell uname -m 2>/dev/null || echo not)
5*4882a593SmuzhiyunARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunTEST_GEN_PROGS := $(OUTPUT)/vdso_test_gettimeofday $(OUTPUT)/vdso_test_getcpu
8*4882a593Smuzhiyunifeq ($(ARCH),x86)
9*4882a593SmuzhiyunTEST_GEN_PROGS += $(OUTPUT)/vdso_standalone_test_x86
10*4882a593Smuzhiyunendif
11*4882a593Smuzhiyun
12*4882a593Smuzhiyunifndef CROSS_COMPILE
13*4882a593SmuzhiyunCFLAGS := -std=gnu99
14*4882a593SmuzhiyunCFLAGS_vdso_standalone_test_x86 := -nostdlib -fno-asynchronous-unwind-tables -fno-stack-protector
15*4882a593Smuzhiyunifeq ($(CONFIG_X86_32),y)
16*4882a593SmuzhiyunLDLIBS += -lgcc_s
17*4882a593Smuzhiyunendif
18*4882a593Smuzhiyun
19*4882a593Smuzhiyunall: $(TEST_GEN_PROGS)
20*4882a593Smuzhiyun$(OUTPUT)/vdso_test_gettimeofday: parse_vdso.c vdso_test_gettimeofday.c
21*4882a593Smuzhiyun$(OUTPUT)/vdso_test_getcpu: parse_vdso.c vdso_test_getcpu.c
22*4882a593Smuzhiyun$(OUTPUT)/vdso_standalone_test_x86: vdso_standalone_test_x86.c parse_vdso.c
23*4882a593Smuzhiyun	$(CC) $(CFLAGS) $(CFLAGS_vdso_standalone_test_x86) \
24*4882a593Smuzhiyun		vdso_standalone_test_x86.c parse_vdso.c \
25*4882a593Smuzhiyun		-o $@
26*4882a593Smuzhiyun
27*4882a593Smuzhiyunendif
28