public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools: Use builtin $(abspath ...) instead of $(shell cd ... && pwd)
@ 2016-04-08  9:15 Thierry Reding
  2016-04-18 14:46 ` Michal Marek
  0 siblings, 1 reply; 6+ messages in thread
From: Thierry Reding @ 2016-04-08  9:15 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, linux-kernel

From: Thierry Reding <treding@nvidia.com>

Avoid forking off a shell to resolve the absolute path of the output
directory when make's builtin $(abspath ...) function will do an
adequate job.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 Makefile                       | 4 ++--
 tools/scripts/Makefile.include | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 173437debc87..c1e3ece3684f 100644
--- a/Makefile
+++ b/Makefile
@@ -1542,11 +1542,11 @@ image_name:
 # Clear a bunch of variables before executing the submake
 tools/: FORCE
 	$(Q)mkdir -p $(objtree)/tools
-	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(src)/tools/
 
 tools/%: FORCE
 	$(Q)mkdir -p $(objtree)/tools
-	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ $*
+	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(src)/tools/ $*
 
 # Single targets
 # ---------------------------------------------------------------------------
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index 5467da41dc72..4d34d0729ac9 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -1,7 +1,7 @@
 ifneq ($(O),)
 ifeq ($(origin O), command line)
 	dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),)
-	ABSOLUTE_O := $(shell cd $(O) ; pwd)
+	ABSOLUTE_O := $(abspath $(O))
 	OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
 	COMMAND_O := O=$(ABSOLUTE_O)
 ifeq ($(objtree),)
-- 
2.8.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-05-19  2:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-08  9:15 [PATCH] tools: Use builtin $(abspath ...) instead of $(shell cd ... && pwd) Thierry Reding
2016-04-18 14:46 ` Michal Marek
2016-04-18 15:05   ` Thierry Reding
2016-04-18 15:17     ` Maciej W. Rozycki
2016-04-18 15:32       ` Thierry Reding
2017-05-19  2:07         ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox