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.
Unified · Split
| @@ -119,10 +119,10 @@ CLANG ?= clang · 118 unmodified lines | ||
| 119 | 119 | |
| 120 | 120 | # Trick to allow make to be run from this directory |
| 121 | 121 | all: |
| 122 | − $(MAKE) -C ../../ $$PWD/ | |
| 122 | + $(MAKE) -C ../../ $(CURDIR)/ | |
| 123 | 123 | |
| 124 | 124 | clean: |
| 125 | − $(MAKE) -C ../../ M=$$PWD clean | |
| 125 | + $(MAKE) -C ../../ M=$(CURDIR) clean | |
| 126 | 126 | @rm -f *~ |
| 127 | 127 | |
| 128 | 128 | # Verify LLVM compiler tools are available and bpf target is supported by llc |
| @@ -13,4 +13,4 @@ HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include · 12 unmodified lines | ||
| 13 | 13 | all: modules |
| 14 | 14 | |
| 15 | 15 | modules clean: |
| 16 | − $(MAKE) -C ../.. SUBDIRS=$(PWD) $@ | |
| 16 | + $(MAKE) -C ../.. SUBDIRS=$(CURDIR) $@ | |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | ifeq ($(srctree),) |
| 2 | −srctree := $(patsubst %/,%,$(dir $(shell pwd))) | |
| 2 | +srctree := $(patsubst %/,%,$(dir $(CURDIR))) | |
| 3 | 3 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 4 | 4 | endif |
| 5 | 5 | |
| @@ -3,7 +3,7 @@ include ../scripts/Makefile.include · 2 unmodified lines | ||
| 3 | 3 | bindir ?= /usr/bin |
| 4 | 4 | |
| 5 | 5 | ifeq ($(srctree),) |
| 6 | −srctree := $(patsubst %/,%,$(dir $(shell pwd))) | |
| 6 | +srctree := $(patsubst %/,%,$(dir $(CURDIR))) | |
| 7 | 7 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 8 | 8 | endif |
| 9 | 9 | |
| @@ -2,7 +2,7 @@ include ../../scripts/Makefile.include · 1 unmodified line | ||
| 2 | 2 | include ../../scripts/utilities.mak # QUIET_CLEAN |
| 3 | 3 | |
| 4 | 4 | ifeq ($(srctree),) |
| 5 | −srctree := $(patsubst %/,%,$(dir $(shell pwd))) | |
| 5 | +srctree := $(patsubst %/,%,$(dir $(CURDIR))) | |
| 6 | 6 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 7 | 7 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 8 | 8 | #$(info Determined 'srctree' to be $(srctree)) |
| @@ -7,7 +7,7 @@ BPF_EXTRAVERSION = 1 · 6 unmodified lines | ||
| 7 | 7 | MAKEFLAGS += --no-print-directory |
| 8 | 8 | |
| 9 | 9 | ifeq ($(srctree),) |
| 10 | −srctree := $(patsubst %/,%,$(dir $(shell pwd))) | |
| 10 | +srctree := $(patsubst %/,%,$(dir $(CURDIR))) | |
| 11 | 11 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 12 | 12 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 13 | 13 | #$(info Determined 'srctree' to be $(srctree)) |
| @@ -50,7 +50,7 @@ ifndef VERBOSE · 49 unmodified lines | ||
| 50 | 50 | endif |
| 51 | 51 | |
| 52 | 52 | ifeq ($(srctree),) |
| 53 | −srctree := $(patsubst %/,%,$(dir $(shell pwd))) | |
| 53 | +srctree := $(patsubst %/,%,$(dir $(CURDIR))) | |
| 54 | 54 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 55 | 55 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 56 | 56 | #$(info Determined 'srctree' to be $(srctree)) |
| @@ -2,7 +2,7 @@ include ../../scripts/Makefile.include · 1 unmodified line | ||
| 2 | 2 | include ../../scripts/utilities.mak # QUIET_CLEAN |
| 3 | 3 | |
| 4 | 4 | ifeq ($(srctree),) |
| 5 | −srctree := $(patsubst %/,%,$(dir $(shell pwd))) | |
| 5 | +srctree := $(patsubst %/,%,$(dir $(CURDIR))) | |
| 6 | 6 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 7 | 7 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 8 | 8 | #$(info Determined 'srctree' to be $(srctree)) |
| @@ -86,7 +86,7 @@ ifndef VERBOSE · 85 unmodified lines | ||
| 86 | 86 | endif |
| 87 | 87 | |
| 88 | 88 | ifeq ($(srctree),) |
| 89 | −srctree := $(patsubst %/,%,$(dir $(shell pwd))) | |
| 89 | +srctree := $(patsubst %/,%,$(dir $(CURDIR))) | |
| 90 | 90 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 91 | 91 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 92 | 92 | #$(info Determined 'srctree' to be $(srctree)) |
| @@ -11,12 +11,12 @@ LD = ld · 10 unmodified lines | ||
| 11 | 11 | AR = ar |
| 12 | 12 | |
| 13 | 13 | ifeq ($(srctree),) |
| 14 | −srctree := $(patsubst %/,%,$(dir $(shell pwd))) | |
| 14 | +srctree := $(patsubst %/,%,$(dir $(CURDIR))) | |
| 15 | 15 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 16 | 16 | endif |
| 17 | 17 | |
| 18 | 18 | SUBCMD_SRCDIR = $(srctree)/tools/lib/subcmd/ |
| 19 | −LIBSUBCMD_OUTPUT = $(if $(OUTPUT),$(OUTPUT),$(PWD)/) | |
| 19 | +LIBSUBCMD_OUTPUT = $(if $(OUTPUT),$(OUTPUT),$(CURDIR)/) | |
| 20 | 20 | LIBSUBCMD = $(LIBSUBCMD_OUTPUT)libsubcmd.a |
| 21 | 21 | |
| 22 | 22 | OBJTOOL := $(OUTPUT)objtool |
| @@ -94,7 +94,7 @@ LC_NUMERIC=C · 93 unmodified lines | ||
| 94 | 94 | export LC_COLLATE LC_NUMERIC |
| 95 | 95 | |
| 96 | 96 | ifeq ($(srctree),) |
| 97 | −srctree := $(patsubst %/,%,$(dir $(shell pwd))) | |
| 97 | +srctree := $(patsubst %/,%,$(dir $(CURDIR))) | |
| 98 | 98 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 99 | 99 | #$(info Determined 'srctree' to be $(srctree)) |
| 100 | 100 | endif |
| @@ -42,7 +42,7 @@ LC_NUMERIC=C · 41 unmodified lines | ||
| 42 | 42 | export LC_COLLATE LC_NUMERIC |
| 43 | 43 | |
| 44 | 44 | ifeq ($(srctree),) |
| 45 | −srctree := $(patsubst %/,%,$(dir $(shell pwd))) | |
| 45 | +srctree := $(patsubst %/,%,$(dir $(CURDIR))) | |
| 46 | 46 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 47 | 47 | #$(info Determined 'srctree' to be $(srctree)) |
| 48 | 48 | endif |
| @@ -108,9 +108,6 @@ MKDIR = mkdir · 107 unmodified lines | ||
| 108 | 108 | # 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. | |
| 112 | −PWD = $(shell pwd) | |
| 113 | − | |
| 114 | 111 | GMO_FILES = ${shell for HLANG in ${LANGUAGES}; do echo $(OUTPUT)po/$$HLANG.gmo; done;} |
| 115 | 112 | |
| 116 | 113 | export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS |
| @@ -1,7 +1,6 @@ | ||
| 1 | 1 | obj-m := |
| 2 | 2 | |
| 3 | 3 | KDIR := /lib/modules/$(shell uname -r)/build |
| 4 | −PWD := $(shell pwd) | |
| 5 | 4 | KMISC := /lib/modules/$(shell uname -r)/cpufrequtils/ |
| 6 | 5 | |
| 7 | 6 | ifeq ("$(CONFIG_X86_TSC)", "y") |
| @@ -9,7 +8,7 @@ ifeq ("$(CONFIG_X86_TSC)", "y") · 1 unmodified line | ||
| 9 | 8 | endif |
| 10 | 9 | |
| 11 | 10 | default: |
| 12 | − $(MAKE) -C $(KDIR) M=$(PWD) | |
| 11 | + $(MAKE) -C $(KDIR) M=$(CURDIR) | |
| 13 | 12 | |
| 14 | 13 | clean: |
| 15 | 14 | - rm -rf *.o *.ko .tmp-versions .*.cmd .*.mod.* *.mod.c |