Skip to contentSkip to conversation

kbuild: Do not clean resolve_btfids if the output does not exist

PATCH Applied Jiri Olsa 2 participants 2 messages Feb 11, 2021

Subsystems (4)
lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

PATCH 1/1 kbuild: Do not clean resolve_btfids if the output does not exist

Nathan reported issue with cleaning empty build directory:

  $ make -s O=build distclean
  ../../scripts/Makefile.include:4: *** \
  O=/ho...build/tools/bpf/resolve_btfids does not exist.  Stop.

The problem that tools scripts require existing output directory, otherwise it fails.

Adding check around the resolve_btfids clean target to ensure the output directory is in place.

---
 Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Makefile +7 -1
index 159d9592b587..b6fa039c18b8 100644
@@ -1088,8 +1088,14 @@ endif
 
 PHONY += resolve_btfids_clean
 
+resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids
+
+# tools/bpf/resolve_btfids directory might not exist
+# in output directory, skip its clean in that case
 resolve_btfids_clean:
-	$(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean
+ifneq ($(wildcard $(resolve_btfids_O)),)
+	$(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
+endif
 
 ifdef CONFIG_BPF
 ifdef CONFIG_DEBUG_INFO_BTF
Signature · 1 line
2.29.2
#1 lore raw
This patch was applied to bpf/bpf-next.git (refs/heads/master):

Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

Quoted 10 lines · On Thu, 11 Feb 2021 13:40:04 +0100 you wrote:

Nathan reported issue with cleaning empty build directory:

  $ make -s O=build distclean
  ../../scripts/Makefile.include:4: *** \
  O=/ho...build/tools/bpf/resolve_btfids does not exist.  Stop.

The problem that tools scripts require existing output directory, otherwise it fails.

[...]

Here is the summary with links:
- [bpf-next] kbuild: Do not clean resolve_btfids if the output does not exist

    https://git.kernel.org/bpf/bpf-next/c/0e1aa629f1ce

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html