make use of make variable CURDIR instead of calling pwd
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 22 Nov 2016 08:30:26 +0000 (09:30 +0100)
committerMichal Marek <mmarek@suse.com>
Sun, 11 Dec 2016 11:12:56 +0000 (12:12 +0100)
make already provides the current working directory in a variable, so make
use of it instead of forking a shell. Also replace usage of PWD by
CURDIR. PWD is provided by most shells, but not all, so this makes the
build system more robust.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Michal Marek <mmarek@suse.com>
14 files changed:
samples/bpf/Makefile
samples/connector/Makefile
tools/build/Makefile
tools/gpio/Makefile
tools/lib/api/Makefile
tools/lib/bpf/Makefile
tools/lib/lockdep/Makefile
tools/lib/subcmd/Makefile
tools/lib/traceevent/Makefile
tools/objtool/Makefile
tools/perf/Makefile.perf
tools/perf/tests/make
tools/power/cpupower/Makefile
tools/power/cpupower/debug/kernel/Makefile

index 12b7304d55dcd2e64515c6a0af7c777a44f3e645..b1e322860a7f3b2a4ad56bd47c7369267b3d7ff2 100644 (file)
@@ -119,10 +119,10 @@ CLANG ?= clang
 
 # Trick to allow make to be run from this directory
 all:
-       $(MAKE) -C ../../ $$PWD/
+       $(MAKE) -C ../../ $(CURDIR)/
 
 clean:
-       $(MAKE) -C ../../ M=$$PWD clean
+       $(MAKE) -C ../../ M=$(CURDIR) clean
        @rm -f *~
 
 # Verify LLVM compiler tools are available and bpf target is supported by llc
index 04b9622b6f515082a15f021a41e71b9223e14bae..91762d946a53eb08d301be0448f80fcdadafe999 100644 (file)
@@ -13,4 +13,4 @@ HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include
 all: modules
 
 modules clean:
-       $(MAKE) -C ../.. SUBDIRS=$(PWD) $@
+       $(MAKE) -C ../.. SUBDIRS=$(CURDIR) $@
index 8332959fbca4fb5b9a6c4f89b5ef479133ca9b43..aaf7ed329a453a87b91a38f73b6cc25c27764c82 100644 (file)
@@ -1,5 +1,5 @@
 ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 endif
 
index 250a891e6ef0ecd082da136102b3c5a7a6f33a7a..b4401536cfa90f370bbe7c131aa4cba847ad4e2a 100644 (file)
@@ -3,7 +3,7 @@ include ../scripts/Makefile.include
 bindir ?= /usr/bin
 
 ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 endif
 
index 0a6fda9837f7dd3a60a89fbe3083bf8a3835b6f3..adba83b325d556d4b9280114905cdd3fb4b7313a 100644 (file)
@@ -2,7 +2,7 @@ include ../../scripts/Makefile.include
 include ../../scripts/utilities.mak            # QUIET_CLEAN
 
 ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
index 62d89d50fcbd0484e7c38883b9d3d512e627eaef..e2efddf1023177c202d626257c8466f3cb8c40c3 100644 (file)
@@ -7,7 +7,7 @@ BPF_EXTRAVERSION = 1
 MAKEFLAGS += --no-print-directory
 
 ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
index 1d57af56814b8671c10d9619202f042ad5c031d4..3bc0ef9f8923060c6bf6f9aebda2bdc4866e74f7 100644 (file)
@@ -50,7 +50,7 @@ ifndef VERBOSE
 endif
 
 ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
index ce4b7e5275661774d6db64e1eeaa5086c7de732a..3f8cc44a0dbdad3665ad7b1f03a58a6ce3f92707 100644 (file)
@@ -2,7 +2,7 @@ include ../../scripts/Makefile.include
 include ../../scripts/utilities.mak            # QUIET_CLEAN
 
 ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
index 7851df1490e0a81f6a17776bbdb464f564a99894..938f73cec20d211e88c708c8b38b947e34816480 100644 (file)
@@ -86,7 +86,7 @@ ifndef VERBOSE
 endif
 
 ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
index 041b493ad3ab5133f8503e549f6c1cfc717d4b89..27e019c09bd2c41d8014e30bd79342a91fc28e09 100644 (file)
@@ -11,12 +11,12 @@ LD = ld
 AR = ar
 
 ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 endif
 
 SUBCMD_SRCDIR          = $(srctree)/tools/lib/subcmd/
-LIBSUBCMD_OUTPUT       = $(if $(OUTPUT),$(OUTPUT),$(PWD)/)
+LIBSUBCMD_OUTPUT       = $(if $(OUTPUT),$(OUTPUT),$(CURDIR)/)
 LIBSUBCMD              = $(LIBSUBCMD_OUTPUT)libsubcmd.a
 
 OBJTOOL    := $(OUTPUT)objtool
index 982d6439bb07b974d069304a0d4e1686aeaa02e5..5bdef736a662bbcf87244b8b41dbabe4a66e7faf 100644 (file)
@@ -94,7 +94,7 @@ LC_NUMERIC=C
 export LC_COLLATE LC_NUMERIC
 
 ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
 endif
index 143f4d549769abf769c32361f0abecdef7efd880..3482e9f67326530cec80029851f9fd7c6a24e386 100644 (file)
@@ -42,7 +42,7 @@ LC_NUMERIC=C
 export LC_COLLATE LC_NUMERIC
 
 ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
 endif
index 8358863259c53463d86d0578b9837b10201dc266..d6e1c02ddcfead4532cdc73f2d81207f62a8db5f 100644 (file)
@@ -108,9 +108,6 @@ MKDIR = mkdir
 # Now we set up the build system
 #
 
-# set up PWD so that older versions of make will work with our build.
-PWD = $(shell pwd)
-
 GMO_FILES = ${shell for HLANG in ${LANGUAGES}; do echo $(OUTPUT)po/$$HLANG.gmo; done;}
 
 export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS
index 96b146fe6f8d02db3d94dccefe401919a693450f..a8a6f8eec5c2d5d125d0e43ee1a4316d4b91b2d6 100644 (file)
@@ -1,7 +1,6 @@
 obj-m  :=
 
 KDIR   := /lib/modules/$(shell uname -r)/build
-PWD            := $(shell pwd)
 KMISC   := /lib/modules/$(shell uname -r)/cpufrequtils/
 
 ifeq ("$(CONFIG_X86_TSC)", "y")
@@ -9,7 +8,7 @@ ifeq ("$(CONFIG_X86_TSC)", "y")
 endif
 
 default:
-       $(MAKE) -C $(KDIR) M=$(PWD)
+       $(MAKE) -C $(KDIR) M=$(CURDIR)
 
 clean:
        - rm -rf *.o *.ko .tmp-versions .*.cmd .*.mod.* *.mod.c