From 622cef6f81a297b51728fd47c9ae8986bd5a4c76 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 16 Dec 2018 00:50:39 +0100 Subject: makefile: use immediate expansion and use correct template patterns --- contrib/examples/extract-handshakes/Makefile | 1 + contrib/examples/extract-keys/Makefile | 1 + src/compat/Kbuild.include | 2 +- src/crypto/Kbuild.include | 12 ++++++------ 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/contrib/examples/extract-handshakes/Makefile b/contrib/examples/extract-handshakes/Makefile index 36e951e..77b42f1 100644 --- a/contrib/examples/extract-handshakes/Makefile +++ b/contrib/examples/extract-handshakes/Makefile @@ -24,5 +24,6 @@ offset-finder-m := offset-finder.o oldsrc := $(src) src := $(src)/../../../src include $(src)/compat/Kbuild.include +include $(src)/crypto/Kbuild.include src := $(oldsrc) endif diff --git a/contrib/examples/extract-keys/Makefile b/contrib/examples/extract-keys/Makefile index 8f5901a..1f7308d 100644 --- a/contrib/examples/extract-keys/Makefile +++ b/contrib/examples/extract-keys/Makefile @@ -27,5 +27,6 @@ config-m := config.o oldsrc := $(src) src := $(src)/../../../src include $(src)/compat/Kbuild.include +include $(src)/crypto/Kbuild.include src := $(oldsrc) endif diff --git a/src/compat/Kbuild.include b/src/compat/Kbuild.include index 530f71d..2164dbf 100644 --- a/src/compat/Kbuild.include +++ b/src/compat/Kbuild.include @@ -2,7 +2,7 @@ # # Copyright (C) 2015-2018 Jason A. Donenfeld . All Rights Reserved. -kbuild-dir ?= $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) +kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) ccflags-y += -include $(kbuild-dir)/compat/compat.h asflags-y += -include $(kbuild-dir)/compat/compat-asm.h diff --git a/src/crypto/Kbuild.include b/src/crypto/Kbuild.include index e93f3af..460684d 100644 --- a/src/crypto/Kbuild.include +++ b/src/crypto/Kbuild.include @@ -39,13 +39,13 @@ zinc-$(CONFIG_ZINC_ARCH_ARM) += curve25519/curve25519-arm.o quiet_cmd_perlasm = PERLASM $@ cmd_perlasm = $(PERL) $< > $@ -%.S: %.pl - $(call cmd,perlasm) -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-)))) +$(obj)/%.S: $(src)/%.pl FORCE + $(call if_changed,perlasm) +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)) +# Old kernels don't set this, which causes trouble. +.SECONDARY: wireguard-y += $(addprefix crypto/zinc/,$(zinc-y)) ccflags-y += -I$(src)/crypto/include -- cgit v1.2.3-59-g8ed1b