]> git.friedersdorff.com Git - max/tmk_keyboard.git/blobdiff - rules.mk
Add a keymap layer into ADB converter.
[max/tmk_keyboard.git] / rules.mk
index f1d0a301caf653e401749ad31db9b22b474bfcf1..104031fbb27bc4568ecfd84213d2d10c817789fc 100644 (file)
--- a/rules.mk
+++ b/rules.mk
@@ -121,7 +121,9 @@ CFLAGS += -Wstrict-prototypes
 CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
 CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
 CFLAGS += $(CSTANDARD)
-CFLAGS += -include $(CONFIG_H)
+ifdef CONFIG_H
+    CFLAGS += -include $(CONFIG_H)
+endif
 
 
 #---------------- Compiler Options C++ ----------------
@@ -149,7 +151,9 @@ CPPFLAGS += -Wundef
 CPPFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
 CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
 #CPPFLAGS += $(CSTANDARD)
-CPPFLAGS += -include $(CONFIG_H)
+ifdef CONFIG_H
+    CPPFLAGS += -include $(CONFIG_H)
+endif
 
 
 #---------------- Assembler Options ----------------
@@ -162,7 +166,9 @@ CPPFLAGS += -include $(CONFIG_H)
 #  -listing-cont-lines: Sets the maximum number of continuation lines of hex 
 #       dump that will be displayed for a given single line of source input.
 ASFLAGS = $(ADEFS) -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
-ASFLAGS += -include $(CONFIG_H)
+ifdef CONFIG_H
+    ASFLAGS += -include $(CONFIG_H)
+endif
 
 
 #---------------- Library Options ----------------
@@ -224,12 +230,14 @@ EXTMEMOPTS =
 #      (.vectors+0x30): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_12'
 #
 LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+#LDFLAGS += -Wl,--relax
 LDFLAGS += -Wl,--gc-sections
 LDFLAGS += $(EXTMEMOPTS)
 LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
 LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
 #LDFLAGS += -T linker_script.x
+# You can give EXTRALDFLAGS at 'make' command line.
+LDFLAGS += $(EXTRALDFLAGS)
 
 
 
@@ -315,9 +323,10 @@ GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
 
 # Combine all necessary flags and optional flags.
 # Add target processor to flags.
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
-ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+# You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
+ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)