From 87c985a8adb58ce38d8ee6b60457b4fa24ddfe2b Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 16 Nov 2018 17:17:46 -0800 Subject: crypto: better path resolution and more specific generated .S --- src/compat/Kbuild.include | 12 ++++-------- src/crypto/Kbuild.include | 11 +++++------ 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 . 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 -- cgit v1.2.3-59-g8ed1b