summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2014-07-22 08:33:46 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-30 03:10:06 +0000
commit9797f654d935cdd75ede4ef98b762284d54a5da4 (patch)
treeee7b2521a2f9a843067d38f4c9d1c99685578d02 /Makefile
parenta528f892915c7a20768d49402f052f100f10501e (diff)
downloadchrome-ec-9797f654d935cdd75ede4ef98b762284d54a5da4.tar.gz
Makefile: Add support for per-board symlinks to top level
Previously if you were working on a single board you had to add BOARD= to all of your make command lines. Now if you are in a board directory you can just use "make", or "make clean", or any other top level make command. This commit also adds support for a top level "make flash" command that can be used from the board directories as well. This command uses openocd and requires that the board provides an openocd-flash.cfg file. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=none TEST=(from a few board directories) make clean; make -j (from the discovery-stm32f072 directory) make flash Change-Id: Ie09a74881371169a2c3cd9cd9922f39f4873f1a6 Reviewed-on: https://chromium-review.googlesource.com/209669 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 20 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 26ec921b8f..204dbdfdbf 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,24 @@
# Embedded Controller firmware build system
#
+# If we came here via a symlink we restart make and deduce the correct BOARD
+# value from the current directory.
+SYMLINK := $(shell readlink $(lastword $(MAKEFILE_LIST)))
+
+ifneq (,$(SYMLINK))
+
+.PHONY: restart
+
+restart: .DEFAULT
+ @true
+
+.DEFAULT:
+ @$(MAKE) -C $(dir $(SYMLINK)) \
+ --no-print-directory \
+ $(MAKECMDGOALS) \
+ BOARD=$(notdir $(shell pwd))
+else
+
BOARD ?= bds
PROJECT?=ec
@@ -95,3 +113,5 @@ dirs=core/$(CORE) chip/$(CHIP) board/$(BOARD) private common power test util
dirs+=$(shell find driver -type d)
include Makefile.rules
+
+endif # SYMLINK