From e6e9b5adc830c0924d81c348c8d5b12e3dc4242e Mon Sep 17 00:00:00 2001 From: Ben Cressey Date: Mon, 19 Apr 2021 18:46:04 +0000 Subject: [PATCH] Makefile: add prepare target for external modules We need to ensure that native versions of programs like `objtool` are built before trying to build out-of-tree modules, or else the build will fail. Unlike other distributions, we cannot include these programs in our kernel-devel archive, because we rely on cross-compilation: these are "host" programs and may not match the architecture of the target. Ideally, out-of-tree builds would run `make prepare` first, so that these programs could be compiled in the normal fashion. We ship all the files needed for this to work. However, this requirement is specific to our use case, and DKMS does not support it. Adding a minimal prepare target to the dependency graph causes the programs to be built automatically and improves compatibility with existing solutions. Signed-off-by: Ben Cressey Signed-off-by: Arnaldo Garcia Rincon --- Makefile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Makefile b/Makefile index 23390805e..2f78ac123 100644 --- a/Makefile +++ b/Makefile @@ -1874,6 +1874,19 @@ else # KBUILD_EXTMOD KBUILD_BUILTIN := KBUILD_MODULES := 1 +PHONY += modules_prepare +modules_prepare: + $(Q)$(MAKE) $(build)=scripts/basic + $(Q)$(MAKE) $(build)=scripts/dtc + $(Q)$(MAKE) $(build)=scripts/mod + $(Q)$(MAKE) $(build)=scripts + +ifdef CONFIG_OBJTOOL +prepare: tools/objtool +endif + +prepare: modules_prepare + build-dir := $(KBUILD_EXTMOD) compile_commands.json: $(extmod_prefix)compile_commands.json -- 2.40.0