Skip to content

Commit e19b7ce

Browse files
Uwe Kleine-KönigMichal Marek
Uwe Kleine-König
authored and
Michal Marek
committed
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. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Michal Marek <[email protected]>
1 parent 76bee23 commit e19b7ce

File tree

14 files changed

+15
-19
lines changed

14 files changed

+15
-19
lines changed

samples/bpf/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ CLANG ?= clang
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
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include
1313
all: modules
1414

1515
modules clean:
16-
$(MAKE) -C ../.. SUBDIRS=$(PWD) $@
16+
$(MAKE) -C ../.. SUBDIRS=$(CURDIR) $@

tools/build/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -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
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include ../scripts/Makefile.include
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
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include ../../scripts/Makefile.include
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
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ BPF_EXTRAVERSION = 1
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
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ ifndef VERBOSE
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
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include ../../scripts/Makefile.include
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
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ ifndef VERBOSE
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
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ LD = ld
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
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ LC_NUMERIC=C
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
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ LC_NUMERIC=C
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

-3
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ MKDIR = mkdir
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
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
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")
87
obj-m += cpufreq-test_tsc.o
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

0 commit comments

Comments
 (0)