From 9d056547e6b55546367974f1746c654c082a112f Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sun, 29 Sep 2019 20:09:42 -0600 Subject: [PATCH] Add includes from each directory --- Makefile | 16 ++++++++++------ src/arch/8051/arch.mk | 2 +- src/arch/avr/arch.mk | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 2aa5d9e..b99291e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Parameter for current board -#BOARD?=system76/galp3-c -BOARD?=arduino/mega2560 +BOARD?=system76/galp3-c +#BOARD?=arduino/mega2560 # Set build directory BUILD=build/$(BOARD) @@ -14,26 +14,30 @@ clean: # Include common source SRC=$(wildcard src/*.c) -INCLUDE=$(wildcard src/include/*.h) +INCLUDE=$(wildcard src/include/common/*.h) +CFLAGS=-Isrc/include # Include the board's source BOARD_DIR=src/board/$(BOARD) 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 # The board will define the embedded controller # Include the embedded controller's source EC_DIR=src/ec/$(EC) 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 # The EC will define the architecture # Include the architecture's source ARCH_DIR=src/arch/$(ARCH) 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 # The architecture defines build targets, no more is required diff --git a/src/arch/8051/arch.mk b/src/arch/8051/arch.mk index 37b9505..4e6255a 100644 --- a/src/arch/8051/arch.mk +++ b/src/arch/8051/arch.mk @@ -22,4 +22,4 @@ $(BUILD)/ec.ihx: $(OBJ) # Compile C files into object files $(BUILD)/%.rel: src/%.c $(INCLUDE) @mkdir -p $(@D) - $(CC) -o $@ -c $< + $(CC) $(CFLAGS) -o $@ -c $< diff --git a/src/arch/avr/arch.mk b/src/arch/avr/arch.mk index b754757..08b2dd7 100644 --- a/src/arch/avr/arch.mk +++ b/src/arch/avr/arch.mk @@ -23,4 +23,4 @@ $(BUILD)/ec.elf: $(OBJ) # Compile C files into object files $(BUILD)/%.o: src/%.c $(INCLUDE) @mkdir -p $(@D) - $(CC) -o $@ -c $< + $(CC) $(CFLAGS) -o $@ -c $<