summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-08-15 08:45:36 +0300
committerFred Sundvik <fsundvik@gmail.com>2016-08-20 03:56:40 +0300
commit33fbd3be36bf58c6a02fb6b4ae99dc5bca7c8e58 (patch)
tree02b6bf1f1c4e02af6dd5bfb6c4f3a570540e23b1
parent3aac4e95c91be3244d68f27159c2667904c8fddd (diff)
Output specific include paths
-rw-r--r--build_keyboard.mk31
-rw-r--r--tmk_core/rules.mk18
2 files changed, 22 insertions, 27 deletions
diff --git a/build_keyboard.mk b/build_keyboard.mk
index d10412ea57..0debc49259 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -43,8 +43,22 @@ ifneq ($(SUBPROJECT),)
endif
endif
-# Save the defs here, so we don't include any keymap specific ones
+# We can assume a ChibiOS target When MCU_FAMILY is defined, since it's not used for LUFA
+ifdef MCU_FAMILY
+ PLATFORM=CHIBIOS
+else
+ PLATFORM=AVR
+endif
+
+ifeq ($(PLATFORM),CHIBIOS)
+ include $(TMK_PATH)/protocol/chibios.mk
+ include $(TMK_PATH)/chibios.mk
+ OPT_OS = chibios
+endif
+
+# Save the defines and includes here, so we don't include any keymap specific ones
PROJECT_DEFS := $(OPT_DEFS)
+PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(SUBPROJECT_PATH) $(KEYBOARD_PATH)
MAIN_KEYMAP_PATH := $(KEYBOARD_PATH)/keymaps/$(KEYMAP)
MAIN_KEYMAP_C := $(MAIN_KEYMAP_PATH)/keymap.c
@@ -72,19 +86,6 @@ else
KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD)
endif
-# We can assume a ChibiOS target When MCU_FAMILY is defined, since it's not used for LUFA
-ifdef MCU_FAMILY
- PLATFORM=CHIBIOS
-else
- PLATFORM=AVR
-endif
-
-ifeq ($(PLATFORM),CHIBIOS)
- include $(TMK_PATH)/protocol/chibios.mk
- include $(TMK_PATH)/chibios.mk
- OPT_OS = chibios
-endif
-
# Object files directory
# To put object files in current directory, use a dot (.), do NOT make
# this an empty or blank macro!
@@ -190,8 +191,10 @@ endif
OUTPUTS := $(KEYMAP_OUTPUT) $(KEYBOARD_OUTPUT)
$(KEYMAP_OUTPUT)_SRC := $(SRC)
$(KEYMAP_OUTPUT)_DEFS := $(OPT_DEFS) -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\"
+$(KEYMAP_OUTPUT)_INC := $(EXTRAINCDIRS) $(VPATH)
$(KEYBOARD_OUTPUT)_SRC := $(CHIBISRC)
$(KEYBOARD_OUTPUT)_DEFS := $(PROJECT_DEFS)
+$(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC)
include $(TMK_PATH)/rules.mk
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index 9f6d8d9dfd..7b2c842ed6 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -49,13 +49,6 @@ OPT = s
AUTOGEN ?= false
-# List any extra directories to look for include files here.
-# Each directory must be seperated by a space.
-# Use forward slashes for directory separators.
-# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS += $(subst :, ,$(VPATH_SRC))
-
-
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
@@ -104,7 +97,6 @@ CFLAGS += -Wstrict-prototypes
#CFLAGS += -Wunreachable-code
#CFLAGS += -Wsign-compare
CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
-CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
ifdef CONFIG_H
CFLAGS += -include $(CONFIG_H)
@@ -131,7 +123,6 @@ CPPFLAGS += -Wundef
#CPPFLAGS += -Wunreachable-code
#CPPFLAGS += -Wsign-compare
CPPFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
-CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
#CPPFLAGS += $(CSTANDARD)
ifdef CONFIG_H
CPPFLAGS += -include $(CONFIG_H)
@@ -149,7 +140,6 @@ endif
# dump that will be displayed for a given single line of source input.
ASFLAGS += $(ADEFS)
ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
-ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
ifdef CONFIG_H
ASFLAGS += -include $(CONFIG_H)
endif
@@ -305,9 +295,11 @@ BEGIN = gccversion sizebefore
define GEN_OBJRULE
-$1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS)
-$1_CPPFLAGS= $$(ALL_CPPFLAGS) $$($1_DEFS)
-$1_ASFLAGS= $$(ALL_ASFLAGS) $$($1_DEFS)
+$1_INCFLAGS := $$(patsubst %,-I%,$$($1_INC))
+$1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS)
+$1_CPPFLAGS= $$(ALL_CPPFLAGS) $$($1_DEFS) $$($1_INCFLAGS)
+$1_ASFLAGS= $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS)
+$$(info $$($1_INCFLAGS))
# Compile: create object files from C source files.
$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)