aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-11-16 17:17:46 -0800
committerJason A. Donenfeld <Jason@zx2c4.com>2018-11-16 17:26:16 -0800
commit87c985a8adb58ce38d8ee6b60457b4fa24ddfe2b (patch)
treedab54f114e3b50250bf79143e915c4eb92985e1d
parentchacha20,poly1305: don't do compiler testing in generator and remove xor helper (diff)
downloadwireguard-monolithic-historical-87c985a8adb58ce38d8ee6b60457b4fa24ddfe2b.tar.xz
wireguard-monolithic-historical-87c985a8adb58ce38d8ee6b60457b4fa24ddfe2b.zip
crypto: better path resolution and more specific generated .S
-rw-r--r--src/compat/Kbuild.include12
-rw-r--r--src/crypto/Kbuild.include11
2 files changed, 9 insertions, 14 deletions
diff --git a/src/compat/Kbuild.include b/src/compat/Kbuild.include
index 03a4ea3..530f71d 100644
--- a/src/compat/Kbuild.include
+++ b/src/compat/Kbuild.include
@@ -2,14 +2,10 @@
#
# 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
+kbuild-dir ?= $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
-ccflags-y += -include $(cmd_include_path_prefix)/compat/compat.h
-asflags-y += -include $(cmd_include_path_prefix)/compat/compat-asm.h
+ccflags-y += -include $(kbuild-dir)/compat/compat.h
+asflags-y += -include $(kbuild-dir)/compat/compat-asm.h
ifeq ($(wildcard $(srctree)/include/linux/ptr_ring.h),)
ccflags-y += -I$(src)/compat/ptr_ring/include
@@ -47,7 +43,7 @@ wireguard-y += compat/udp_tunnel/udp_tunnel.o
endif
ifeq ($(shell grep -s -F "int crypto_memneq" "$(srctree)/include/crypto/algapi.h"),)
-ccflags-y += -include $(cmd_include_path_prefix)/compat/memneq/include.h
+ccflags-y += -include $(kbuild-dir)/compat/memneq/include.h
wireguard-y += compat/memneq/memneq.o
endif
diff --git a/src/crypto/Kbuild.include b/src/crypto/Kbuild.include
index 4fde2e6..e93f3af 100644
--- a/src/crypto/Kbuild.include
+++ b/src/crypto/Kbuild.include
@@ -41,12 +41,11 @@ quiet_cmd_perlasm = PERLASM $@
cmd_perlasm = $(PERL) $< > $@
%.S: %.pl
$(call cmd,perlasm)
-ifeq ($(wildcard $(src)/compat/compat.h),)
-target_path_prefix := $(srctree)/$(src)
-else
-target_path_prefix := $(src)
-endif
-.SECONDARY: $(addprefix $(target_path_prefix)/,$(patsubst %.o,crypto/zinc/%.S,$(zinc-y)))
+kbuild-dir ?= $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
+targets += $(patsubst $(kbuild-dir)/%.pl,%.S,$(wildcard $(patsubst %.o,$(kbuild-dir)/crypto/zinc/%.pl,$(zinc-y) $(zinc-m) $(zinc-))))
+
+# Old kernels don't have targets, so use SECONDARY manually, which requires the full path
+.SECONDARY: $(addprefix $(kbuild-dir)/,$(targets))
wireguard-y += $(addprefix crypto/zinc/,$(zinc-y))
ccflags-y += -I$(src)/crypto/include