Add includes from each directory
This commit is contained in:
parent
2fa764e879
commit
9d056547e6
16
Makefile
16
Makefile
@ -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
|
||||||
|
@ -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 $<
|
||||||
|
@ -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 $<
|
||||||
|
Loading…
x
Reference in New Issue
Block a user