diff mbox

mtd-utils: Use $(CURDIR) in place of $(PWD)

Message ID 90498d8ec2a6b99c34b3bc61cf5e6444@localhost
State Accepted
Commit 351ac23f8d468b2b9bc60dfcbaacbe3d55ec11f9
Headers show

Commit Message

Kevin Cernekee Sept. 28, 2010, 12:22 a.m. UTC
$(PWD) comes from the shell and may cause unexpected side effects when
using "make -C".

$(CURDIR) is defined internally by GNU make.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
 Makefile  |    2 +-
 common.mk |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Artem Bityutskiy Sept. 28, 2010, 6:48 a.m. UTC | #1
On Mon, 2010-09-27 at 17:22 -0700, Kevin Cernekee wrote:
> $(PWD) comes from the shell and may cause unexpected side effects when
> using "make -C".
> 
> $(CURDIR) is defined internally by GNU make.
> 
> Signed-off-by: Kevin Cernekee <cernekee@gmail.com>

Pushed, thanks!
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 93661cb..7ab9743 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@  clean::
 	-rm -f $(SYMLINKS)
 ifneq ($(BUILDDIR)/.git,)
 ifneq ($(BUILDDIR),.)
-ifneq ($(BUILDDIR),$(PWD))
+ifneq ($(BUILDDIR),$(CURDIR))
 	rm -rf $(BUILDDIR)
 endif
 endif
diff --git a/common.mk b/common.mk
index be785b4..0444ad9 100644
--- a/common.mk
+++ b/common.mk
@@ -26,10 +26,10 @@  INCLUDEDIR=$(PREFIX)/include
 
 ifndef BUILDDIR
 ifeq ($(origin CROSS),undefined)
-  BUILDDIR := $(PWD)
+  BUILDDIR := $(CURDIR)
 else
 # Remove the trailing slash to make the directory name
-  BUILDDIR := $(PWD)/$(CROSS:-=)
+  BUILDDIR := $(CURDIR)/$(CROSS:-=)
 endif
 endif
 override BUILDDIR := $(patsubst %/,%,$(BUILDDIR))