]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - tmk_core/rules.mk
Merge remote-tracking branch 'upstream/master' into makefile_overhaul
[qmk_firmware.git] / tmk_core / rules.mk
index 9f6d8d9dfd35f99986627857f68ed3dab881e632..21011c2808f5898e23026fd6338b32df2791d19f 100644 (file)
@@ -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,11 +97,7 @@ 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)
-endif
 
 
 #---------------- Compiler Options C++ ----------------
@@ -131,12 +120,7 @@ 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)
-endif
-
 
 #---------------- Assembler Options ----------------
 #  -Wa,...:   tell GCC to pass this to the assembler.
@@ -149,10 +133,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
 
 #---------------- Library Options ----------------
 # Minimalistic printf version
@@ -305,9 +285,13 @@ 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))
+ifdef $1_CONFIG
+$1_CONFIG_FLAGS += -include $$($1_CONFIG)
+endif
+$1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS)
+$1_CPPFLAGS= $$(ALL_CPPFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS)
+$1_ASFLAGS= $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS)
 
 # Compile: create object files from C source files.
 $1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)
@@ -368,8 +352,7 @@ $(foreach OUTPUT,$(OUTPUTS),$(eval $(call GEN_OBJRULE,$(OUTPUT))))
 
 # Target: clean project.
 clean:
-       $(REMOVE) -r $(OBJDIR) 2>/dev/null
-       $(REMOVE) -r $(KBOBJDIR) 2>/dev/null
+       $(foreach OUTPUT,$(OUTPUTS), $(REMOVE) -r $(OUTPUT) 2>/dev/null)
        $(REMOVE) $(BUILD_DIR)/$(TARGET).*
 
 show_path: