Skip to content

Commit 94d0a95

Browse files
masahir0ymehmetb0
authored andcommitted
tools: fix annoying "mkdir -p ..." logs when building tools in parallel
BugLink: https://bugs.launchpad.net/bugs/2104873 [ Upstream commit d1d0963 ] When CONFIG_OBJTOOL=y or CONFIG_DEBUG_INFO_BTF=y, parallel builds show awkward "mkdir -p ..." logs. $ make -j16 [ snip ] mkdir -p /home/masahiro/ref/linux/tools/objtool && make O=/home/masahiro/ref/linux subdir=tools/objtool --no-print-directory -C objtool mkdir -p /home/masahiro/ref/linux/tools/bpf/resolve_btfids && make O=/home/masahiro/ref/linux subdir=tools/bpf/resolve_btfids --no-print-directory -C bpf/resolve_btfids Defining MAKEFLAGS=<value> on the command line wipes out command line switches from the resultant MAKEFLAGS definition, even though the command line switches are active. [1] MAKEFLAGS puts all single-letter options into the first word, and that word will be empty if no single-letter options were given. [2] However, this breaks if MAKEFLAGS=<value> is given on the command line. The tools/ and tools/% targets set MAKEFLAGS=<value> on the command line, which breaks the following code in tools/scripts/Makefile.include: short-opts := $(firstword -$(MAKEFLAGS)) If MAKEFLAGS really needs modification, it should be done through the environment variable, as follows: MAKEFLAGS=<value> $(MAKE) ... That said, I question whether modifying MAKEFLAGS is necessary here. The only flag we might want to exclude is --no-print-directory, as the tools build system changes the working directory. However, people might find the "Entering/Leaving directory" logs annoying. I simply removed the offending MAKEFLAGS=<value>. [1]: https://savannah.gnu.org/bugs/?62469 [2]: https://www.gnu.org/software/make/manual/make.html#Testing-Flags Fixes: ea01fa9 ("tools: Connect to the kernel build system") Fixes: a50e433 ("perf tools: Honor parallel jobs") Signed-off-by: Masahiro Yamada <[email protected]> Tested-by: Daniel Xu <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Noah Wager <[email protected]> Signed-off-by: Mehmet Basaran <[email protected]>
1 parent 52ce7b0 commit 94d0a95

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Makefile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,18 +1353,13 @@ ifneq ($(wildcard $(resolve_btfids_O)),)
13531353
$(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
13541354
endif
13551355

1356-
# Clear a bunch of variables before executing the submake
1357-
ifeq ($(quiet),silent_)
1358-
tools_silent=s
1359-
endif
1360-
13611356
tools/: FORCE
13621357
$(Q)mkdir -p $(objtree)/tools
1363-
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
1358+
$(Q)$(MAKE) LDFLAGS= O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
13641359

13651360
tools/%: FORCE
13661361
$(Q)mkdir -p $(objtree)/tools
1367-
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
1362+
$(Q)$(MAKE) LDFLAGS= O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
13681363

13691364
# ---------------------------------------------------------------------------
13701365
# Kernel selftest

0 commit comments

Comments
 (0)