Skip to contentSkip to conversation

Makefile: drop redundant shell call when deriving BASE_DIR

PATCH New Danomi Manchego 2 participants 2 messages Nov 23, 2016 – Nov 27, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: drop redundant shell call when deriving BASE_DIR

Commit 173135df5b69dfd5ae6fe6cf2de8833c6f74c143 ("core: re-enter make if $(CURDIR) or $(O) are not canonical paths") introduced the CANONICAL_O variable, defined as:

CANONICAL_O := $(shell mkdir -p $(O) >/dev/null 2>&1)$(realpath $(O))

This duplicates the definition of BASE_DIR, by different means:

BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)

So one of these shell calls is redundant. CANONICAL_O is defined first, so this commit replaces the BASE_DIR derivation with $(CANONICAL_O).

---
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Makefile +3 -3
index 37e4bd4..a4a6147 100644
@@ -165,10 +165,10 @@ endif
 
 # bash prints the name of the directory on 'cd <dir>' if CDPATH is
 # set, so unset it here to not cause problems. Notice that the export
-# line doesn't affect the environment of $(shell ..) calls, so
-# explictly throw away any output from 'cd' here.
+# line doesn't affect the environment of $(shell ..) calls.
 export CDPATH :=
-BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
+
+BASE_DIR := $(CANONICAL_O)
 $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
 
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 Makefile: drop redundant shell call when deriving BASE_DIR

Hello,

Quoted 10 lines · Danomi Manchego

Commit 173135df5b69dfd5ae6fe6cf2de8833c6f74c143 ("core: re-enter make if $(CURDIR) or $(O) are not canonical paths") introduced the CANONICAL_O variable, defined as:

CANONICAL_O := $(shell mkdir -p $(O) >/dev/null 2>&1)$(realpath $(O))

This duplicates the definition of BASE_DIR, by different means:

BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)

Quoted 7 lines

So one of these shell calls is redundant. CANONICAL_O is defined first, so this commit replaces the BASE_DIR derivation with $(CANONICAL_O).

---
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied to next, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com