Generate and use compiler dep rules

SDCC supports the `-MMD` option. Use it instead of having every file
depend on *all* the headers. Reduces incremental build time after
modifying headers as it will now only rebuild the actual dependents and
not the entire project.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2023-01-11 12:28:13 -07:00
committed by Tim Crawford
parent 84fe76cad4
commit 9a52042f95
10 changed files with 25 additions and 14 deletions

View File

@@ -25,14 +25,14 @@ all: $(BUILD)/ec.rom
# Include common source
COMMON_DIR=src/common
INCLUDE=$(wildcard $(COMMON_DIR)/include/common/*.h) $(COMMON_DIR)/common.mk
INCLUDE += $(COMMON_DIR)/common.mk
CFLAGS=-I$(COMMON_DIR)/include -D__FIRMWARE_VERSION__=$(VERSION)
include $(COMMON_DIR)/common.mk
SRC += $(foreach src, $(common-y), $(COMMON_DIR)/$(src))
# Include the board's source
BOARD_DIR=src/board/$(BOARD)
INCLUDE+=$(wildcard $(BOARD_DIR)/include/board/*.h) $(BOARD_DIR)/board.mk
INCLUDE += $(BOARD_DIR)/board.mk
CFLAGS+=-I$(BOARD_DIR)/include -D__BOARD__=$(BOARD)
include $(BOARD_DIR)/board.mk
SRC += $(foreach src, $(board-y), $(BOARD_DIR)/$(src))
@@ -42,7 +42,7 @@ SRC += $(foreach src, $(keyboard-y), $(KEYBOARD_DIR)/$(src))
# The board will define the embedded controller
# Include the embedded controller's source
EC_DIR=src/ec/$(EC)
INCLUDE+=$(wildcard $(EC_DIR)/include/ec/*.h) $(EC_DIR)/ec.mk
INCLUDE += $(EC_DIR)/ec.mk
CFLAGS+=-I$(EC_DIR)/include
include $(EC_DIR)/ec.mk
SRC += $(foreach src, $(ec-y), $(EC_DIR)/$(src))
@@ -50,7 +50,7 @@ SRC += $(foreach src, $(ec-y), $(EC_DIR)/$(src))
# The EC will define the architecture
# Include the architecture's source
ARCH_DIR=src/arch/$(ARCH)
INCLUDE+=$(wildcard $(ARCH_DIR)/include/arch/*.h) $(ARCH_DIR)/arch.mk
INCLUDE += $(ARCH_DIR)/arch.mk
CFLAGS+=-I$(ARCH_DIR)/include -D__ARCH__=$(ARCH)
include $(ARCH_DIR)/arch.mk
SRC += $(foreach src, $(arch-y), $(ARCH_DIR)/$(src))