summaryrefslogtreecommitdiffhomepage
path: root/src/compat/Kbuild.include
blob: 04ffdeb01328c34de129579652f6df64d068244d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.

ifeq ($(wildcard $(src)/compat/compat.h),)
cmd_include_path_prefix := $(srctree)/$(src)
else
cmd_include_path_prefix := $(src)
endif

ccflags-y += -include $(cmd_include_path_prefix)/compat/compat.h
asflags-y += -include $(cmd_include_path_prefix)/compat/compat-asm.h

ifeq ($(wildcard $(srctree)/include/linux/ptr_ring.h),)
ccflags-y += -I$(src)/compat/ptr_ring/include
endif

ifeq ($(wildcard $(srctree)/include/linux/siphash.h),)
ccflags-y += -I$(src)/compat/siphash/include
wireguard-y += compat/siphash/siphash.o
endif

ifeq ($(wildcard $(srctree)/include/net/dst_cache.h),)
ccflags-y += -I$(src)/compat/dst_cache/include
wireguard-y += compat/dst_cache/dst_cache.o
endif

ifeq ($(wildcard $(srctree)/arch/x86/include/asm/intel-family.h)$(CONFIG_X86),y)
ccflags-y += -I$(src)/compat/intel-family-x86/include
endif

ifeq ($(wildcard $(srctree)/arch/x86/include/asm/fpu/api.h)$(CONFIG_X86),y)
ccflags-y += -I$(src)/compat/fpu-x86/include
endif

ifeq ($(wildcard $(srctree)/arch/x86/include/asm/simd.h)$(CONFIG_X86),y)
ccflags-y += -I$(src)/compat/simd-x86/include
endif

ifeq ($(wildcard $(srctree)/include/net/udp_tunnel.h),)
ccflags-y += -I$(src)/compat/udp_tunnel/include
wireguard-y += compat/udp_tunnel/udp_tunnel.o
endif

ifeq ($(shell grep -F "int crypto_memneq" "$(srctree)/include/crypto/algapi.h"),)
ccflags-y += -include $(cmd_include_path_prefix)/compat/memneq/include.h
wireguard-y += compat/memneq/memneq.o
endif

ifeq ($(wildcard $(srctree)/arch/arm/include/asm/neon.h)$(CONFIG_ARM),y)
ccflags-y += -I$(src)/compat/neon-arm/include
endif
ifeq ($(wildcard $(srctree)/arch/arm64/include/asm/neon.h)$(CONFIG_ARM64),y)
ccflags-y += -I$(src)/compat/neon-arm/include
endif

ifeq ($(CONFIG_X86_64),y)
	ifeq ($(ssse3_instr),)
		ssse3_instr := $(call as-instr,pshufb %xmm0$(comma)%xmm0,-DCONFIG_AS_SSSE3=1)
		ccflags-y += $(ssse3_instr)
		asflags-y += $(ssse3_instr)
	endif
	ifeq ($(avx_instr),)
		avx_instr := $(call as-instr,vxorps %ymm0$(comma)%ymm1$(comma)%ymm2,-DCONFIG_AS_AVX=1)
		ccflags-y += $(avx_instr)
		asflags-y += $(avx_instr)
	endif
	ifeq ($(avx2_instr),)
		avx2_instr := $(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1)
		ccflags-y += $(avx2_instr)
		asflags-y += $(avx2_instr)
	endif
	ifeq ($(avx512_instr),)
		avx512_instr := $(call as-instr,vpmovm2b %k1$(comma)%zmm5,-DCONFIG_AS_AVX512=1)
		ccflags-y += $(avx512_instr)
		asflags-y += $(avx512_instr)
	endif
endif