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