win-build: fixes to build with alternative make implementations

Some make implementations have different implementations for
notdir and absdir functions.
notdir may require that his parameter do not finish with "\".
absdir may fail when given a windows formated path as input.

The path that is given to notdir as parameter is removed from
the final "\" and abspath is replaced with realpath when the
input given can be a windows formated path.

Jira: ZEP-762

Change-Id: Ic83e3526fc5234decb3192ab1f9f538addf9a76e
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
This commit is contained in:
Juan Manuel Cruz 2016-08-26 17:24:13 -05:00 committed by Anas Nashif
commit 941059c69f
2 changed files with 9 additions and 3 deletions

View file

@ -738,13 +738,18 @@ export KBUILD_IMAGE ?= zephyr
zephyr-dirs := $(patsubst %/,%,$(filter %/, $(core-y) $(drivers-y) \
$(libs-y)))
# Workaround for some make notdir implementations that require
# the paramenter not to end in "/".
zephyr-app-dir-root-name := $(patsubst %/,%, $(SOURCE_DIR))
zephyr-app-dir-root := $(abspath $(patsubst %, %/.., $(SOURCE_DIR)))
zephyr-alldirs := $(sort $(zephyr-dirs) $(SOURCE_DIR) $(patsubst %/,%,$(filter %/, \
$(core-) $(drivers-) $(libs-) $(app-))))
core-y := $(patsubst %/, %/built-in.o, $(core-y))
app-y := $(patsubst %, %/built-in.o, $(notdir $(SOURCE_DIR)))
app-y := $(patsubst %, %/built-in.o, $(notdir $(zephyr-app-dir-root-name)))
drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y))
libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
@ -895,7 +900,8 @@ $(zephyr-dirs): prepare scripts
PHONY += zephyr-app-dir
zephyr-app-dir: prepare scripts
$(Q)$(MAKE) $(build)=$(notdir $(SOURCE_DIR)) srctree=$(zephyr-app-dir-root)
$(Q)$(MAKE) $(build)=$(notdir $(zephyr-app-dir-root-name)) \
srctree=$(zephyr-app-dir-root)
# Things we need to do before we recursively start building the kernel
# or the modules are listed in "prepare".

View file

@ -48,7 +48,7 @@ KERNEL_TYPE ?= micro
override CONF_FILE := $(strip $(subst $(DQUOTE),,$(CONF_FILE)))
SOURCE_DIR ?= $(PROJECT_BASE)/src/
override SOURCE_DIR := $(abspath $(SOURCE_DIR))
override SOURCE_DIR := $(realpath $(SOURCE_DIR))
override SOURCE_DIR := $(subst \,/,$(SOURCE_DIR))
override SOURCE_DIR_PARENT := $(patsubst %, %/.., $(SOURCE_DIR))
override SOURCE_DIR_PARENT := $(abspath $(SOURCE_DIR_PARENT))