aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbryan newbold <bnewbold@robocracy.org>2014-10-05 23:09:54 -0700
committerbnewbold <bnewbold@robocracy.org>2015-02-28 23:19:34 -0800
commit8e441906ff4ac7a328481a7602cb851958a88d06 (patch)
tree1a7b2cd2b797f1563de663fbbfd5a121903de0cb
parentf23af97214dc8664a1bc83951a65040e121a7364 (diff)
downloadlibrambutan-8e441906ff4ac7a328481a7602cb851958a88d06.tar.gz
librambutan-8e441906ff4ac7a328481a7602cb851958a88d06.zip
buildsys: allow out-of-tree board files
This allows custom hardware boards (using existing chipset support) to be targeted without patches to the libmaple repository. See also commit in firmware-template repo.
-rw-r--r--Makefile2
-rw-r--r--wirish/rules.mk16
2 files changed, 15 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 82ba456..c4ffe26 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ LIBRARIES_PATH := $(SRCROOT)/libraries
LDDIR := $(SUPPORT_PATH)/ld
# Support files for this Makefile
MAKEDIR := $(SUPPORT_PATH)/make
-BOARD_INCLUDE_DIR := $(MAKEDIR)/board-includes
+BOARD_INCLUDE_DIR ?= $(MAKEDIR)/board-includes
##
## Target-specific configuration. This determines some compiler and
diff --git a/wirish/rules.mk b/wirish/rules.mk
index 3a1fb81..13da229 100644
--- a/wirish/rules.mk
+++ b/wirish/rules.mk
@@ -8,12 +8,21 @@ BUILDDIRS += $(BUILD_PATH)/$(d)
# BUILDDIRS. These are in subdirectories, but they're logically part
# of the Wirish submodule. That's a bit inconsistent with libmaple
# proper, and should be fixed.
+# Optionally support out-of-tree board files if WIRISH_BOARD_PATH was exported
+ifeq ($(WIRISH_BOARD_PATH),)
WIRISH_BOARD_PATH := boards/$(BOARD)
+WIRISH_BOARD_INCLUDE := $(d)/$(WIRISH_BOARD_PATH)/include
+WIRISH_BOARD_CPP_FILE := $(d)/$(WIRISH_BOARD_PATH)/board.cpp
BUILDDIRS += $(BUILD_PATH)/$(d)/$(WIRISH_BOARD_PATH)
+else
+WIRISH_BOARD_INCLUDE := $(WIRISH_BOARD_PATH)/include
+WIRISH_BOARD_CPP_FILE := $(WIRISH_BOARD_PATH)/board.cpp
+BUILDDIRS += $(BUILD_PATH)/$(WIRISH_BOARD_PATH)
+endif
BUILDDIRS += $(BUILD_PATH)/$(d)/$(TARGET_SERIES_MODULE)
# Safe includes for Wirish.
-WIRISH_INCLUDES := -I$(d)/include -I$(d)/$(WIRISH_BOARD_PATH)/include
+WIRISH_INCLUDES := -I$(d)/include -I$(WIRISH_BOARD_INCLUDE)
# Local flags. Add -I$(d) to allow for private includes.
CFLAGS_$(d) := $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -I$(d)
@@ -42,12 +51,15 @@ cppSRCS_$(d) += wirish_time.cpp
cppSRCS_$(d) += $(TARGET_SERIES_MODULE)/boards_setup.cpp
cppSRCS_$(d) += $(TARGET_SERIES_MODULE)/wirish_digital.cpp
cppSRCS_$(d) += $(TARGET_SERIES_MODULE)/wirish_debug.cpp
-cppSRCS_$(d) += $(WIRISH_BOARD_PATH)/board.cpp
sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%)
cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%)
cppFILES_$(d) := $(cppSRCS_$(d):%=$(d)/%)
+# board.cpp is a special case, because it may be out of tree
+cppSRCS_$(d) += $(WIRISH_BOARD_PATH)/board.cpp
+cppFILES_$(d) += $(WIRISH_BOARD_CPP_FILE)
+
OBJS_$(d) := $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) \
$(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) \
$(cppFILES_$(d):%.cpp=$(BUILD_PATH)/%.o)