aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-16 00:50:39 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-18 14:41:48 +0100
commit622cef6f81a297b51728fd47c9ae8986bd5a4c76 (patch)
tree6765f60843bbc1c076438b0ad9813f1201ba9400
parentnetns: nmap != ncat (diff)
downloadWireGuard-622cef6f81a297b51728fd47c9ae8986bd5a4c76.tar.xz
WireGuard-622cef6f81a297b51728fd47c9ae8986bd5a4c76.zip
makefile: use immediate expansion and use correct template patterns
-rw-r--r--contrib/examples/extract-handshakes/Makefile1
-rw-r--r--contrib/examples/extract-keys/Makefile1
-rw-r--r--src/compat/Kbuild.include2
-rw-r--r--src/crypto/Kbuild.include12
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 <Jason@zx2c4.com>. 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