summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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