summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2019-02-20 10:30:57 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-21 06:29:58 -0800
commit4fa8490306ae6da842c620e23385fd75e94432e4 (patch)
tree2cf392513bfaa6cda856c634bd201eb854ef8b8f
parentb88737c61c0bdb70c69d2eb95360095f6f07e5fd (diff)
downloadchrome-ec-4fa8490306ae6da842c620e23385fd75e94432e4.tar.gz
Makefile: Allow board to be both in public and private folders
All current boards only exist in either board/$BOARD, or in private-*/board/$BOARD. However, for kukui_scp, we want to be able to use the same target for public and private builds, extending functions by adding some files in private-mt8183/board/kukui_scp. Change the Makefile inclusion logic to make this possible. BRANCH=none BUG=b:124804731 TEST=On m/master make buildall -j; mv build build.old After this CL: make buildall -j ls build/*/*/ec.*.smap | sed -e 's|build/||' | \ xargs -I{} diff build/{} build.old/{} => no difference Change-Id: I595a7b9159d5c9a54f25a8e7d09437ab47d3dbcd Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1475107 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r--Makefile31
1 files changed, 24 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index d2dc18e3ba..716100fb88 100644
--- a/Makefile
+++ b/Makefile
@@ -16,18 +16,29 @@ ARCH?=amd64
BOARD ?= bds
# Directory where the board is configured (includes /$(BOARD) at the end)
-BDIR:=$(wildcard board/$(BOARD) private-*/board/$(BOARD))
-# There can be only one <insert exploding windows here>
-ifeq (,$(BDIR))
+BDIR:=$(wildcard board/$(BOARD))
+# Private board directory
+PBDIR:=$(wildcard private-*/board/$(BOARD))
+
+# We need either public, or private board directory, or both.
+ifeq (,$(BDIR)$(PBDIR))
$(error unable to locate BOARD $(BOARD))
endif
-ifneq (1,$(words $(BDIR)))
-$(error multiple definitions for BOARD $(BOARD): $(BDIR))
+
+# Setup PDIR (private directory root).
+ifneq (,$(PBDIR))
+ifneq (1,$(words $(PBDIR)))
+$(error multiple private definitions for BOARD $(BOARD): $(PBDIR))
endif
-ifneq ($(filter private-%,$(BDIR)),)
+
PDIR=$(subst /board/$(BOARD),,$(BDIR))
endif
+# If only private is present, use that as BDIR.
+ifeq (,$(BDIR))
+BDIR:=$(PBDIR)
+endif
+
PROJECT?=ec
# Output directory for build objects
@@ -215,6 +226,9 @@ include power/build.mk
ifneq ($(PDIR),)
include $(PDIR)/build.mk
endif
+ifneq ($(PBDIR),)
+include $(PBDIR)/build.mk
+endif
include test/build.mk
include util/build.mk
include util/lock/build.mk
@@ -235,6 +249,9 @@ all-obj-$(1)+=$(call objs_from_dir_p,private,private,$(1))
ifneq ($(PDIR),)
all-obj-$(1)+=$(call objs_from_dir_p,$(PDIR),$(PDIR),$(1))
endif
+ifneq ($(PBDIR),)
+all-obj-$(1)+=$(call objs_from_dir_p,$(PBDIR),board-private,$(1))
+endif
all-obj-$(1)+=$(call objs_from_dir_p,common,common,$(1))
all-obj-$(1)+=$(call objs_from_dir_p,driver,driver,$(1))
all-obj-$(1)+=$(call objs_from_dir_p,power,power,$(1))
@@ -254,7 +271,7 @@ $(eval $(call get_sources,ro))
dirs=core/$(CORE) chip/$(CHIP) $(BASEDIR) $(BDIR) common fuzz power test \
cts/common cts/$(CTS_MODULE) $(out)/gen
-dirs+= private $(PDIR)
+dirs+= private $(PDIR) $(PBDIR)
dirs+=$(shell find common -type d)
dirs+=$(shell find driver -type d)
common_dirs=util