From 8a47f8a44d98b93c540ea0cf9516fa2ea154b5fa Mon Sep 17 00:00:00 2001 From: Alexander Staubo Date: Sun, 22 Feb 2015 22:30:10 -0500 Subject: [PATCH] Makefile: Calculate $(GOROOT), etc. relative to Makefile instead of using $(PWD), which is not always available (eg., in debuild). --- Makefile | 4 ++-- Makefile.INCLUDE | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 677804543..f17aad623 100644 --- a/Makefile +++ b/Makefile @@ -66,10 +66,10 @@ config: $(MAKE) -C config $(SELFLINK): $(GOPATH) - ln -s $(CURDIR) $@ + ln -s $(MAKEFILE_DIR) $@ $(GOPATH): - cp -a $(CURDIR)/Godeps/_workspace $(GOPATH) + cp -a $(MAKEFILE_DIR)/Godeps/_workspace $(GOPATH) dependencies: $(GOCC) | $(SELFLINK) diff --git a/Makefile.INCLUDE b/Makefile.INCLUDE index 44d00b49b..742d755f7 100644 --- a/Makefile.INCLUDE +++ b/Makefile.INCLUDE @@ -24,7 +24,9 @@ ARCH=$(shell uname -m) # Mac OS X release family. MAC_OS_X_VERSION ?= 10.8 -BUILD_PATH = $(PWD)/.build +MAKEFILE_DIR ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) + +BUILD_PATH = $(MAKEFILE_DIR)/.build GO_VERSION := 1.4 GOOS = $(subst Darwin,darwin,$(subst Linux,linux,$(subst FreeBSD,freebsd,$(OS))))