History

make use of make variable CURDIR instead of calling pwd

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.

Uwe Kleine-König committed 9 years ago

Commit e19b7ce1 parent 76bee2314 files · +15 −19Browse files

Unified · Split

14 files
  1. samples/bpf/Makefile +2 −2
  2. samples/connector/Makefile +1 −1
  3. tools/build/Makefile +1 −1
  4. tools/gpio/Makefile +1 −1
  5. tools/lib/api/Makefile +1 −1
  6. tools/lib/bpf/Makefile +1 −1
  7. tools/lib/lockdep/Makefile +1 −1
  8. tools/lib/subcmd/Makefile +1 −1
  9. tools/lib/traceevent/Makefile +1 −1
  10. tools/objtool/Makefile +2 −2
  11. tools/perf/Makefile.perf +1 −1
  12. tools/perf/tests/make +1 −1
  13. tools/power/cpupower/Makefile +0 −3
  14. tools/power/cpupower/debug/kernel/Makefile +1 −2
samples/bpf/Makefile+2−2
@@ -119,10 +119,10 @@ CLANG ?= clang · 118 unmodified lines
119119
120120 # Trick to allow make to be run from this directory
121121 all:
122− $(MAKE) -C ../../ $$PWD/
122+ $(MAKE) -C ../../ $(CURDIR)/
123123
124124 clean:
125− $(MAKE) -C ../../ M=$$PWD clean
125+ $(MAKE) -C ../../ M=$(CURDIR) clean
126126 @rm -f *~
127127
128128 # Verify LLVM compiler tools are available and bpf target is supported by llc
samples/connector/Makefile+1−1
@@ -13,4 +13,4 @@ HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include · 12 unmodified lines
1313 all: modules
1414
1515 modules clean:
16− $(MAKE) -C ../.. SUBDIRS=$(PWD) $@
16+ $(MAKE) -C ../.. SUBDIRS=$(CURDIR) $@
tools/build/Makefile+1−1
@@ -1,5 +1,5 @@
11 ifeq ($(srctree),)
2−srctree := $(patsubst %/,%,$(dir $(shell pwd)))
2+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
33 srctree := $(patsubst %/,%,$(dir $(srctree)))
44 endif
55
tools/gpio/Makefile+1−1
@@ -3,7 +3,7 @@ include ../scripts/Makefile.include · 2 unmodified lines
33 bindir ?= /usr/bin
44
55 ifeq ($(srctree),)
6−srctree := $(patsubst %/,%,$(dir $(shell pwd)))
6+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
77 srctree := $(patsubst %/,%,$(dir $(srctree)))
88 endif
99
tools/lib/api/Makefile+1−1
@@ -2,7 +2,7 @@ include ../../scripts/Makefile.include · 1 unmodified line
22 include ../../scripts/utilities.mak # QUIET_CLEAN
33
44 ifeq ($(srctree),)
5−srctree := $(patsubst %/,%,$(dir $(shell pwd)))
5+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
66 srctree := $(patsubst %/,%,$(dir $(srctree)))
77 srctree := $(patsubst %/,%,$(dir $(srctree)))
88 #$(info Determined 'srctree' to be $(srctree))
tools/lib/bpf/Makefile+1−1
@@ -7,7 +7,7 @@ BPF_EXTRAVERSION = 1 · 6 unmodified lines
77 MAKEFLAGS += --no-print-directory
88
99 ifeq ($(srctree),)
10−srctree := $(patsubst %/,%,$(dir $(shell pwd)))
10+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
1111 srctree := $(patsubst %/,%,$(dir $(srctree)))
1212 srctree := $(patsubst %/,%,$(dir $(srctree)))
1313 #$(info Determined 'srctree' to be $(srctree))
tools/lib/lockdep/Makefile+1−1
@@ -50,7 +50,7 @@ ifndef VERBOSE · 49 unmodified lines
5050 endif
5151
5252 ifeq ($(srctree),)
53−srctree := $(patsubst %/,%,$(dir $(shell pwd)))
53+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
5454 srctree := $(patsubst %/,%,$(dir $(srctree)))
5555 srctree := $(patsubst %/,%,$(dir $(srctree)))
5656 #$(info Determined 'srctree' to be $(srctree))
tools/lib/subcmd/Makefile+1−1
@@ -2,7 +2,7 @@ include ../../scripts/Makefile.include · 1 unmodified line
22 include ../../scripts/utilities.mak # QUIET_CLEAN
33
44 ifeq ($(srctree),)
5−srctree := $(patsubst %/,%,$(dir $(shell pwd)))
5+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
66 srctree := $(patsubst %/,%,$(dir $(srctree)))
77 srctree := $(patsubst %/,%,$(dir $(srctree)))
88 #$(info Determined 'srctree' to be $(srctree))
tools/lib/traceevent/Makefile+1−1
@@ -86,7 +86,7 @@ ifndef VERBOSE · 85 unmodified lines
8686 endif
8787
8888 ifeq ($(srctree),)
89−srctree := $(patsubst %/,%,$(dir $(shell pwd)))
89+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
9090 srctree := $(patsubst %/,%,$(dir $(srctree)))
9191 srctree := $(patsubst %/,%,$(dir $(srctree)))
9292 #$(info Determined 'srctree' to be $(srctree))
tools/objtool/Makefile+2−2
@@ -11,12 +11,12 @@ LD = ld · 10 unmodified lines
1111 AR = ar
1212
1313 ifeq ($(srctree),)
14−srctree := $(patsubst %/,%,$(dir $(shell pwd)))
14+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
1515 srctree := $(patsubst %/,%,$(dir $(srctree)))
1616 endif
1717
1818 SUBCMD_SRCDIR = $(srctree)/tools/lib/subcmd/
19−LIBSUBCMD_OUTPUT = $(if $(OUTPUT),$(OUTPUT),$(PWD)/)
19+LIBSUBCMD_OUTPUT = $(if $(OUTPUT),$(OUTPUT),$(CURDIR)/)
2020 LIBSUBCMD = $(LIBSUBCMD_OUTPUT)libsubcmd.a
2121
2222 OBJTOOL := $(OUTPUT)objtool
tools/perf/Makefile.perf+1−1
@@ -94,7 +94,7 @@ LC_NUMERIC=C · 93 unmodified lines
9494 export LC_COLLATE LC_NUMERIC
9595
9696 ifeq ($(srctree),)
97−srctree := $(patsubst %/,%,$(dir $(shell pwd)))
97+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
9898 srctree := $(patsubst %/,%,$(dir $(srctree)))
9999 #$(info Determined 'srctree' to be $(srctree))
100100 endif
tools/perf/tests/make+1−1
@@ -42,7 +42,7 @@ LC_NUMERIC=C · 41 unmodified lines
4242 export LC_COLLATE LC_NUMERIC
4343
4444 ifeq ($(srctree),)
45−srctree := $(patsubst %/,%,$(dir $(shell pwd)))
45+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
4646 srctree := $(patsubst %/,%,$(dir $(srctree)))
4747 #$(info Determined 'srctree' to be $(srctree))
4848 endif
tools/power/cpupower/Makefile+0−3
@@ -108,9 +108,6 @@ MKDIR = mkdir · 107 unmodified lines
108108 # Now we set up the build system
109109 #
110110
111−# set up PWD so that older versions of make will work with our build.
112−PWD = $(shell pwd)
113−
114111 GMO_FILES = ${shell for HLANG in ${LANGUAGES}; do echo $(OUTPUT)po/$$HLANG.gmo; done;}
115112
116113 export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS
tools/power/cpupower/debug/kernel/Makefile+1−2
@@ -1,7 +1,6 @@
11 obj-m :=
22
33 KDIR := /lib/modules/$(shell uname -r)/build
4−PWD := $(shell pwd)
54 KMISC := /lib/modules/$(shell uname -r)/cpufrequtils/
65
76 ifeq ("$(CONFIG_X86_TSC)", "y")
@@ -9,7 +8,7 @@ ifeq ("$(CONFIG_X86_TSC)", "y") · 1 unmodified line
98 endif
109
1110 default:
12− $(MAKE) -C $(KDIR) M=$(PWD)
11+ $(MAKE) -C $(KDIR) M=$(CURDIR)
1312
1413 clean:
1514 - rm -rf *.o *.ko .tmp-versions .*.cmd .*.mod.* *.mod.c