From 8e441906ff4ac7a328481a7602cb851958a88d06 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Sun, 5 Oct 2014 23:09:54 -0700 Subject: 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. --- Makefile | 2 +- wirish/rules.mk | 16 ++++++++++++++-- 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) -- cgit v1.2.3