aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Makefile
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2022-09-06 15:13:06 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2022-09-29 04:40:15 +0900
commitcc306abd19e8acdd85072b162d09e80408389cd8 (patch)
tree288aca34d648681e6135b04b89473669f57c81b5 /Makefile
parentkbuild: rewrite check-local-export in sh/awk (diff)
downloadwireguard-linux-cc306abd19e8acdd85072b162d09e80408389cd8.tar.xz
wireguard-linux-cc306abd19e8acdd85072b162d09e80408389cd8.zip
kbuild: fix and refactor single target build
The single target build has a subtle bug for the combination for an individual file and a subdirectory. [1] 'make kernel/fork.i' builds only kernel/fork.i $ make kernel/fork.i CALL scripts/checksyscalls.sh DESCEND objtool CPP kernel/fork.i [2] 'make kernel/' builds only under the kernel/ directory. $ make kernel/ CALL scripts/checksyscalls.sh DESCEND objtool CC kernel/fork.o CC kernel/exec_domain.o [snip] CC kernel/rseq.o AR kernel/built-in.a But, if you try to do [1] and [2] in a single command, you will get only [1] with a weird log: $ make kernel/fork.i kernel/ CALL scripts/checksyscalls.sh DESCEND objtool CPP kernel/fork.i make[2]: Nothing to be done for 'kernel/'. With 'make kernel/fork.i kernel/', you should get both [1] and [2]. Rewrite the single target build. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile9
1 files changed, 4 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index f9756ff7c750..b0a3cba5af94 100644
--- a/Makefile
+++ b/Makefile
@@ -1819,11 +1819,11 @@ single_modpost: $(single-no-ko) modules_prepare
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
$(Q)rm -f $(MODORDER)
-export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod_prefix), $(single-no-ko))
+single-goals := $(addprefix $(extmod_prefix), $(single-no-ko))
# trim unrelated directories
build-dirs := $(foreach d, $(build-dirs), \
- $(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
+ $(if $(filter $d/%, $(single-goals)), $d))
endif
@@ -1835,9 +1835,8 @@ endif
PHONY += descend $(build-dirs)
descend: $(build-dirs)
$(build-dirs): prepare
- $(Q)$(MAKE) $(build)=$@ \
- single-build=$(if $(filter-out $@/, $(filter $@/%, $(KBUILD_SINGLE_TARGETS))),1) \
- need-builtin=1 need-modorder=1
+ $(Q)$(MAKE) $(build)=$@ need-builtin=1 need-modorder=1 \
+ $(filter $@/%, $(single-goals))
clean-dirs := $(addprefix _clean_, $(clean-dirs))
PHONY += $(clean-dirs) clean