Add includes from each directory

This commit is contained in:
Jeremy Soller 2019-09-29 20:09:42 -06:00
parent 2fa764e879
commit 9d056547e6
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1
3 changed files with 12 additions and 8 deletions

View File

@ -1,6 +1,6 @@
# Parameter for current board # Parameter for current board
#BOARD?=system76/galp3-c BOARD?=system76/galp3-c
BOARD?=arduino/mega2560 #BOARD?=arduino/mega2560
# Set build directory # Set build directory
BUILD=build/$(BOARD) BUILD=build/$(BOARD)
@ -14,26 +14,30 @@ clean:
# Include common source # Include common source
SRC=$(wildcard src/*.c) SRC=$(wildcard src/*.c)
INCLUDE=$(wildcard src/include/*.h) INCLUDE=$(wildcard src/include/common/*.h)
CFLAGS=-Isrc/include
# Include the board's source # Include the board's source
BOARD_DIR=src/board/$(BOARD) BOARD_DIR=src/board/$(BOARD)
SRC+=$(wildcard $(BOARD_DIR)/*.c) SRC+=$(wildcard $(BOARD_DIR)/*.c)
INCLUDE+=$(wildcard $(BOARD_DIR)/include/*.h) INCLUDE+=$(wildcard $(BOARD_DIR)/include/board/*.h)
CFLAGS+=-I$(BOARD_DIR)/include
include $(BOARD_DIR)/board.mk include $(BOARD_DIR)/board.mk
# The board will define the embedded controller # The board will define the embedded controller
# Include the embedded controller's source # Include the embedded controller's source
EC_DIR=src/ec/$(EC) EC_DIR=src/ec/$(EC)
SRC+=$(wildcard $(EC_DIR)/*.c) SRC+=$(wildcard $(EC_DIR)/*.c)
INCLUDE+=$(wildcard $(EC_DIR)/include/*.h) INCLUDE+=$(wildcard $(EC_DIR)/include/ec/*.h)
CFLAGS+=-I$(EC_DIR)/include
include $(EC_DIR)/ec.mk include $(EC_DIR)/ec.mk
# The EC will define the architecture # The EC will define the architecture
# Include the architecture's source # Include the architecture's source
ARCH_DIR=src/arch/$(ARCH) ARCH_DIR=src/arch/$(ARCH)
SRC+=$(wildcard $(ARCH_DIR)/*.c) SRC+=$(wildcard $(ARCH_DIR)/*.c)
INCLUDE+=$(wildcard $(ARCH_DIR)/include/*.h) INCLUDE+=$(wildcard $(ARCH_DIR)/include/arch/*.h)
CFLAGS+=-I$(ARCH_DIR)/include
include $(ARCH_DIR)/arch.mk include $(ARCH_DIR)/arch.mk
# The architecture defines build targets, no more is required # The architecture defines build targets, no more is required

View File

@ -22,4 +22,4 @@ $(BUILD)/ec.ihx: $(OBJ)
# Compile C files into object files # Compile C files into object files
$(BUILD)/%.rel: src/%.c $(INCLUDE) $(BUILD)/%.rel: src/%.c $(INCLUDE)
@mkdir -p $(@D) @mkdir -p $(@D)
$(CC) -o $@ -c $< $(CC) $(CFLAGS) -o $@ -c $<

View File

@ -23,4 +23,4 @@ $(BUILD)/ec.elf: $(OBJ)
# Compile C files into object files # Compile C files into object files
$(BUILD)/%.o: src/%.c $(INCLUDE) $(BUILD)/%.o: src/%.c $(INCLUDE)
@mkdir -p $(@D) @mkdir -p $(@D)
$(CC) -o $@ -c $< $(CC) $(CFLAGS) -o $@ -c $<