summaryrefslogtreecommitdiff
path: root/Makefile.inc
diff options
context:
space:
mode:
authorKumar Gala <kumar.gala@linaro.org>2016-06-03 09:51:56 -0500
committerInaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>2016-06-30 16:49:40 +0000
commit23af1e928ec25ec2657bb4a6de58211754dabf62 (patch)
treecc444ce4078f11c86153d55d9c9e83f3ff369133 /Makefile.inc
parent19ff3d3e37ac6a0219e54a7798d14b282fe2e18a (diff)
build: Fix application object files placement when building out of tree
For the application object files to get properly placed in the outdir when the source files are outside of the zephyr tree we need to set $srctree in kbuild to the parent dir of the application source code rather than getting the default of $srctree being set to $ZEPHYR_BASE. By doing this we are able to get the kbuild system to place the object file results in the outdir rather than in the application source dir. Jira: ZEP-369 Change-Id: I4d3ba67a4a38c15978d5bf7e1f0a912e9bf00f08 Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Diffstat (limited to 'Makefile.inc')
-rw-r--r--Makefile.inc9
1 files changed, 5 insertions, 4 deletions
diff --git a/Makefile.inc b/Makefile.inc
index 289f9b677..4953f0dc8 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -39,11 +39,12 @@ $(error BOARD is not defined!)
endif
SOURCE_DIR ?= $(PROJECT_BASE)/src/
-# Kbuild doesn't work correctly if this is an absolute path
-# FIXME Do not depend on python
-override SOURCE_DIR := $(shell python -c "import os.path; print(\"%s\" % os.path.relpath(os.path.realpath('$(SOURCE_DIR)'), os.path.realpath('$(ZEPHYR_BASE)')))")/
+override SOURCE_DIR := $(abspath $(SOURCE_DIR))
override SOURCE_DIR := $(subst \,/,$(SOURCE_DIR))
-export SOURCE_DIR
+override SOURCE_DIR_PARENT := $(patsubst %, %/.., $(SOURCE_DIR))
+override SOURCE_DIR_PARENT := $(abspath $(SOURCE_DIR_PARENT))
+override SOURCE_DIR_PARENT := $(subst \,/,$(SOURCE_DIR_PARENT))
+export SOURCE_DIR SOURCE_DIR_PARENT
ifeq ("$(origin V)", "command line")
KBUILD_VERBOSE = $(V)