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
119 119
120# Trick to allow make to be run from this directory120# Trick to allow make to be run from this directory
121all:121all:
122 $(MAKE) -C ../../ $$PWD/122 $(MAKE) -C ../../ $(CURDIR)/
123 123
124clean:124clean:
125 $(MAKE) -C ../../ M=$$PWD clean125 $(MAKE) -C ../../ M=$(CURDIR) clean
126 @rm -f *~126 @rm -f *~
127 127
128# Verify LLVM compiler tools are available and bpf target is supported by llc128# 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
13all: modules13all: modules
14 14
15modules clean:15modules clean:
16 $(MAKE) -C ../.. SUBDIRS=$(PWD) $@16 $(MAKE) -C ../.. SUBDIRS=$(CURDIR) $@
tools/build/Makefile+1−1
@@ -1,5 +1,5 @@
1ifeq ($(srctree),)1ifeq ($(srctree),)
2srctree := $(patsubst %/,%,$(dir $(shell pwd)))2srctree := $(patsubst %/,%,$(dir $(CURDIR)))
3srctree := $(patsubst %/,%,$(dir $(srctree)))3srctree := $(patsubst %/,%,$(dir $(srctree)))
4endif4endif
5 5
tools/gpio/Makefile+1−1
@@ -3,7 +3,7 @@ include ../scripts/Makefile.include · 2 unmodified lines
3bindir ?= /usr/bin3bindir ?= /usr/bin
4 4
5ifeq ($(srctree),)5ifeq ($(srctree),)
6srctree := $(patsubst %/,%,$(dir $(shell pwd)))6srctree := $(patsubst %/,%,$(dir $(CURDIR)))
7srctree := $(patsubst %/,%,$(dir $(srctree)))7srctree := $(patsubst %/,%,$(dir $(srctree)))
8endif8endif
9 9
tools/lib/api/Makefile+1−1
@@ -2,7 +2,7 @@ include ../../scripts/Makefile.include · 1 unmodified line
2include ../../scripts/utilities.mak # QUIET_CLEAN2include ../../scripts/utilities.mak # QUIET_CLEAN
3 3
4ifeq ($(srctree),)4ifeq ($(srctree),)
5srctree := $(patsubst %/,%,$(dir $(shell pwd)))5srctree := $(patsubst %/,%,$(dir $(CURDIR)))
6srctree := $(patsubst %/,%,$(dir $(srctree)))6srctree := $(patsubst %/,%,$(dir $(srctree)))
7srctree := $(patsubst %/,%,$(dir $(srctree)))7srctree := $(patsubst %/,%,$(dir $(srctree)))
8#$(info Determined 'srctree' to be $(srctree))8#$(info Determined 'srctree' to be $(srctree))
tools/lib/bpf/Makefile+1−1
@@ -7,7 +7,7 @@ BPF_EXTRAVERSION = 1 · 6 unmodified lines
7MAKEFLAGS += --no-print-directory7MAKEFLAGS += --no-print-directory
8 8
9ifeq ($(srctree),)9ifeq ($(srctree),)
10srctree := $(patsubst %/,%,$(dir $(shell pwd)))10srctree := $(patsubst %/,%,$(dir $(CURDIR)))
11srctree := $(patsubst %/,%,$(dir $(srctree)))11srctree := $(patsubst %/,%,$(dir $(srctree)))
12srctree := $(patsubst %/,%,$(dir $(srctree)))12srctree := $(patsubst %/,%,$(dir $(srctree)))
13#$(info Determined 'srctree' to be $(srctree))13#$(info Determined 'srctree' to be $(srctree))
tools/lib/lockdep/Makefile+1−1
@@ -50,7 +50,7 @@ ifndef VERBOSE · 49 unmodified lines
50endif50endif
51 51
52ifeq ($(srctree),)52ifeq ($(srctree),)
53srctree := $(patsubst %/,%,$(dir $(shell pwd)))53srctree := $(patsubst %/,%,$(dir $(CURDIR)))
54srctree := $(patsubst %/,%,$(dir $(srctree)))54srctree := $(patsubst %/,%,$(dir $(srctree)))
55srctree := $(patsubst %/,%,$(dir $(srctree)))55srctree := $(patsubst %/,%,$(dir $(srctree)))
56#$(info Determined 'srctree' to be $(srctree))56#$(info Determined 'srctree' to be $(srctree))
tools/lib/subcmd/Makefile+1−1
@@ -2,7 +2,7 @@ include ../../scripts/Makefile.include · 1 unmodified line
2include ../../scripts/utilities.mak # QUIET_CLEAN2include ../../scripts/utilities.mak # QUIET_CLEAN
3 3
4ifeq ($(srctree),)4ifeq ($(srctree),)
5srctree := $(patsubst %/,%,$(dir $(shell pwd)))5srctree := $(patsubst %/,%,$(dir $(CURDIR)))
6srctree := $(patsubst %/,%,$(dir $(srctree)))6srctree := $(patsubst %/,%,$(dir $(srctree)))
7srctree := $(patsubst %/,%,$(dir $(srctree)))7srctree := $(patsubst %/,%,$(dir $(srctree)))
8#$(info Determined 'srctree' to be $(srctree))8#$(info Determined 'srctree' to be $(srctree))
tools/lib/traceevent/Makefile+1−1
@@ -86,7 +86,7 @@ ifndef VERBOSE · 85 unmodified lines
86endif86endif
87 87
88ifeq ($(srctree),)88ifeq ($(srctree),)
89srctree := $(patsubst %/,%,$(dir $(shell pwd)))89srctree := $(patsubst %/,%,$(dir $(CURDIR)))
90srctree := $(patsubst %/,%,$(dir $(srctree)))90srctree := $(patsubst %/,%,$(dir $(srctree)))
91srctree := $(patsubst %/,%,$(dir $(srctree)))91srctree := $(patsubst %/,%,$(dir $(srctree)))
92#$(info Determined 'srctree' to be $(srctree))92#$(info Determined 'srctree' to be $(srctree))
tools/objtool/Makefile+2−2
@@ -11,12 +11,12 @@ LD = ld · 10 unmodified lines
11AR = ar11AR = ar
12 12
13ifeq ($(srctree),)13ifeq ($(srctree),)
14srctree := $(patsubst %/,%,$(dir $(shell pwd)))14srctree := $(patsubst %/,%,$(dir $(CURDIR)))
15srctree := $(patsubst %/,%,$(dir $(srctree)))15srctree := $(patsubst %/,%,$(dir $(srctree)))
16endif16endif
17 17
18SUBCMD_SRCDIR = $(srctree)/tools/lib/subcmd/18SUBCMD_SRCDIR = $(srctree)/tools/lib/subcmd/
19LIBSUBCMD_OUTPUT = $(if $(OUTPUT),$(OUTPUT),$(PWD)/)19LIBSUBCMD_OUTPUT = $(if $(OUTPUT),$(OUTPUT),$(CURDIR)/)
20LIBSUBCMD = $(LIBSUBCMD_OUTPUT)libsubcmd.a20LIBSUBCMD = $(LIBSUBCMD_OUTPUT)libsubcmd.a
21 21
22OBJTOOL := $(OUTPUT)objtool22OBJTOOL := $(OUTPUT)objtool
tools/perf/Makefile.perf+1−1
@@ -94,7 +94,7 @@ LC_NUMERIC=C · 93 unmodified lines
94export LC_COLLATE LC_NUMERIC94export LC_COLLATE LC_NUMERIC
95 95
96ifeq ($(srctree),)96ifeq ($(srctree),)
97srctree := $(patsubst %/,%,$(dir $(shell pwd)))97srctree := $(patsubst %/,%,$(dir $(CURDIR)))
98srctree := $(patsubst %/,%,$(dir $(srctree)))98srctree := $(patsubst %/,%,$(dir $(srctree)))
99#$(info Determined 'srctree' to be $(srctree))99#$(info Determined 'srctree' to be $(srctree))
100endif100endif
tools/perf/tests/make+1−1
@@ -42,7 +42,7 @@ LC_NUMERIC=C · 41 unmodified lines
42export LC_COLLATE LC_NUMERIC42export LC_COLLATE LC_NUMERIC
43 43
44ifeq ($(srctree),)44ifeq ($(srctree),)
45srctree := $(patsubst %/,%,$(dir $(shell pwd)))45srctree := $(patsubst %/,%,$(dir $(CURDIR)))
46srctree := $(patsubst %/,%,$(dir $(srctree)))46srctree := $(patsubst %/,%,$(dir $(srctree)))
47#$(info Determined 'srctree' to be $(srctree))47#$(info Determined 'srctree' to be $(srctree))
48endif48endif
tools/power/cpupower/Makefile+0−3
@@ -108,9 +108,6 @@ MKDIR = mkdir · 107 unmodified lines
108# Now we set up the build system108# Now we set up the build system
109#109#
110 110
111# set up PWD so that older versions of make will work with our build.
112PWD = $(shell pwd)
113
114GMO_FILES = ${shell for HLANG in ${LANGUAGES}; do echo $(OUTPUT)po/$$HLANG.gmo; done;}111GMO_FILES = ${shell for HLANG in ${LANGUAGES}; do echo $(OUTPUT)po/$$HLANG.gmo; done;}
115 112
116export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS113export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS
tools/power/cpupower/debug/kernel/Makefile+1−2
@@ -1,7 +1,6 @@
1obj-m :=1obj-m :=
2 2
3KDIR := /lib/modules/$(shell uname -r)/build3KDIR := /lib/modules/$(shell uname -r)/build
4PWD := $(shell pwd)
5KMISC := /lib/modules/$(shell uname -r)/cpufrequtils/4KMISC := /lib/modules/$(shell uname -r)/cpufrequtils/
6 5
7ifeq ("$(CONFIG_X86_TSC)", "y")6ifeq ("$(CONFIG_X86_TSC)", "y")
@@ -9,7 +8,7 @@ ifeq ("$(CONFIG_X86_TSC)", "y") · 1 unmodified line
9endif8endif
10 9
11default:10default:
12 $(MAKE) -C $(KDIR) M=$(PWD)11 $(MAKE) -C $(KDIR) M=$(CURDIR)
13 12
14clean:13clean:
15 - rm -rf *.o *.ko .tmp-versions .*.cmd .*.mod.* *.mod.c14 - rm -rf *.o *.ko .tmp-versions .*.cmd .*.mod.* *.mod.c