Skip to content

Commit

Permalink
win-build: fixes to build with alternative make implementations
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jmnlcruz authored and Anas Nashif committed Sep 12, 2016
1 parent c7faacf commit 941059c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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".
Expand Down
2 changes: 1 addition & 1 deletion Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 941059c

Please sign in to comment.