diff mbox

[2/2] Canonicalize $(BASE_DIR)

Message ID 1475230194-18524-3-git-send-email-jezz@sysmic.org
State Rejected
Headers show

Commit Message

Jérôme Pouiller Sept. 30, 2016, 10:09 a.m. UTC
If compilation path contains symlinks, $(*_DIR) variables does not contains
same values depending if user run 'make O=out' or 'make -C out'.

This patch always canonicalize $(BASE_DIR) to avoid this problem.

Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 5e4daef..5c907e5 100644
--- a/Makefile
+++ b/Makefile
@@ -136,7 +136,7 @@  endif
 # line doesn't affect the environment of $(shell ..) calls, so
 # explictly throw away any output from 'cd' here.
 export CDPATH :=
-BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
+BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && readlink -m .)
 $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))