From 0b8c448b300da233de8b8d4fcdb359ec0679a513 Mon Sep 17 00:00:00 2001
From: Travis La Marr <exiva@exiva.net>
Date: Fri, 15 Jul 2016 10:28:23 -0400
Subject: Make DFU wait for bootloader

Added a loop for waiting for the keyboard to be put in bootloader mode,
rather than failing out. Makes building keymaps easier.
---
 tmk_core/avr.mk | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'tmk_core')

diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index 3bf2b34f88..6c03e1650e 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -107,6 +107,10 @@ flip: $(BUILD_DIR)/$(TARGET).hex
 	batchisp -hardware usb -device $(MCU) -operation start reset 0
 
 dfu: $(BUILD_DIR)/$(TARGET).hex sizeafter
+	until dfu-programmer $(MCU) get bootloader-version; do\
+		echo "Error: Bootloader not found. Trying again in 5s." ;\
+		sleep 5 ;\
+	done
 ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1)))
 	dfu-programmer $(MCU) erase --force
 else
-- 
cgit v1.2.3


From d48a4cf1eb80600fb3e8eb859e5b77c954a18137 Mon Sep 17 00:00:00 2001
From: Travis La Marr <exiva@exiva.net>
Date: Fri, 15 Jul 2016 10:41:32 -0400
Subject: Fix OS X Recognizing keyboard as Mouse/Tablet

Modified the LUFA USB HID Descriptor to change the logical/usage
minimums for System Control from 0x01 (Mouse) to 0x81 (System Power
Down), this fixes OS X recognizing the Planck as having a mouse and
tablet, even with mousekeys off.
---
 tmk_core/protocol/lufa/descriptor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'tmk_core')

diff --git a/tmk_core/protocol/lufa/descriptor.c b/tmk_core/protocol/lufa/descriptor.c
index 850a20fdb3..539a58d66b 100644
--- a/tmk_core/protocol/lufa/descriptor.c
+++ b/tmk_core/protocol/lufa/descriptor.c
@@ -140,9 +140,9 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM ExtrakeyReport[] =
     HID_RI_USAGE(8, 0x80), /* System Control */
     HID_RI_COLLECTION(8, 0x01), /* Application */
         HID_RI_REPORT_ID(8, REPORT_ID_SYSTEM),
-        HID_RI_LOGICAL_MINIMUM(16, 0x0001),
+        HID_RI_LOGICAL_MINIMUM(16, 0x0081),
         HID_RI_LOGICAL_MAXIMUM(16, 0x00B7),
-        HID_RI_USAGE_MINIMUM(16, 0x0001), /* System Power Down */
+        HID_RI_USAGE_MINIMUM(16, 0x0081), /* System Power Down */
         HID_RI_USAGE_MAXIMUM(16, 0x00B7), /* System Display LCD Autoscale */
         HID_RI_REPORT_SIZE(8, 16),
         HID_RI_REPORT_COUNT(8, 1),
-- 
cgit v1.2.3


From f9956c2aac357645c4a77887a28c3ab58467893a Mon Sep 17 00:00:00 2001
From: Joe Wasson <jwasson+github@gmail.com>
Date: Sun, 24 Jul 2016 12:56:28 -0700
Subject: Fix compiler warning when PREVENT_STUCK_MODIFIERS is enabled.

---
 tmk_core/common/action_layer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'tmk_core')

diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c
index 63fa2b5ae4..a3c7579642 100644
--- a/tmk_core/common/action_layer.c
+++ b/tmk_core/common/action_layer.c
@@ -111,7 +111,7 @@ void layer_debug(void)
 #endif
 
 #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
-uint8_t source_layers_cache[(MATRIX_ROWS * MATRIX_COLS + 7) / 8][MAX_LAYER_BITS] = {0};
+uint8_t source_layers_cache[(MATRIX_ROWS * MATRIX_COLS + 7) / 8][MAX_LAYER_BITS] = {{0}};
 
 void update_source_layers_cache(keypos_t key, uint8_t layer)
 {
-- 
cgit v1.2.3


From dd770547909ff0bbc391fbf38493cbd08285fb4c Mon Sep 17 00:00:00 2001
From: Gergely Nagy <algernon@madhouse-project.org>
Date: Wed, 27 Jul 2016 08:53:05 +0200
Subject: tmk_core/rules.mk: Make PRINT_ERROR* stop on error

Instead of `&& false`, explicitly `exit 1` to make the rules using these macros
fail. This fixes #571, and likely breaks Travis badly.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
---
 tmk_core/rules.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'tmk_core')

diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index f13351ea19..2bf2a109fb 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -60,9 +60,9 @@ TAB_LOG = printf "\n$$LOG\n\n" | $(AWK) '{ sub(/^/," | "); print }'
 TAB_LOG_PLAIN = printf "$$LOG\n"
 AWK_STATUS = $(AWK) '{ printf " %-10s\n", $$1; }'
 AWK_CMD = $(AWK) '{ printf "%-99s", $$0; }'
-PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && false
+PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && exit 1
 PRINT_WARNING = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG)
-PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && false && break
+PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && exit 1
 PRINT_WARNING_PLAIN = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN)
 PRINT_OK = $(SILENT) || printf " $(OK_STRING)" | $(AWK_STATUS)
 BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi;
-- 
cgit v1.2.3


From e01b4c3fd9a7b66276ffd22dcac25d569d7bb7ff Mon Sep 17 00:00:00 2001
From: Fred Sundvik <fsundvik@gmail.com>
Date: Sat, 9 Jul 2016 00:41:15 +0300
Subject: Most ergodox keymaps compiles on Infinity

There are linker errors due to missing led funcitonality though
---
 tmk_core/common/print.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'tmk_core')

diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h
index 0368bcd4a1..a1352527fc 100644
--- a/tmk_core/common/print.h
+++ b/tmk_core/common/print.h
@@ -29,7 +29,9 @@
 #include <stdbool.h>
 #include "util.h"
 
-
+#if defined(PROTOCOL_CHIBIOS)
+#define PSTR(x) x
+#endif
 
 
 #ifndef NO_PRINT
-- 
cgit v1.2.3


From bf1c865c7a5d21cd7967bf676cafd18fc9f2254d Mon Sep 17 00:00:00 2001
From: Fred Sundvik <fsundvik@gmail.com>
Date: Sat, 9 Jul 2016 20:58:19 +0300
Subject: Speed up ChibiOS keymap compilation

By sharing the external library object files between the whole
keyboard, instead of re-compiling them for each keymap.
---
 tmk_core/rules.mk | 50 +++++++++++++++++++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 17 deletions(-)

(limited to 'tmk_core')

diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index 2bf2a109fb..c81fa68541 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -253,6 +253,14 @@ MSG_SUBMODULE_DIRTY = $(WARN_COLOR)WARNING:$(NO_COLOR)\n \
 
 # Define all object files.
 OBJ = $(patsubst %.c,$(OBJDIR)/%.o,$(patsubst %.cpp,$(OBJDIR)/%.o,$(patsubst %.S,$(OBJDIR)/%.o,$(SRC))))
+# The files in the lib folder are shared between all keymaps, so generate that folder name by removing
+# the keymap from the name
+KBOBJDIR=$(subst _$(KEYMAP),,$(OBJDIR))
+# And fixup the object files to match
+LIBOBJ = $(foreach v,$(OBJ),$(if $(findstring /lib/,$v),$v))
+NONLIBOBJ := $(filter-out $(LIBOBJ),$(OBJ))
+LIBOBJ := $(subst _$(KEYMAP)/,/,$(LIBOBJ))
+OBJ := $(LIBOBJ) $(NONLIBOBJ)
 
 # Define all listing files.
 LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst %.S,$(OBJDIR)/%.lst,$(SRC))))
@@ -370,20 +378,35 @@ BEGIN = gccversion check_submodule sizebefore
 	$(eval CMD=$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS))
 	@$(BUILD_CMD)
 
+define GEN_OBJRULE
 # Compile: create object files from C source files.
-$(OBJDIR)/%.o : %.c | $(BEGIN)
-	@mkdir -p $(@D)
-	@$(SILENT) || printf "$(MSG_COMPILING) $<" | $(AWK_CMD)
-	$(eval CMD=$(CC) -c $(ALL_CFLAGS) $< -o $@)
-	@$(BUILD_CMD)
+$1/%.o : %.c | $(BEGIN)
+	@mkdir -p $$(@D)
+	@$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
+	$$(eval CMD=$$(CC) -c $$(ALL_CFLAGS) $$< -o $$@)
+	@$$(BUILD_CMD)
 
 # Compile: create object files from C++ source files.
-$(OBJDIR)/%.o : %.cpp | $(BEGIN)
-	@mkdir -p $(@D)
-	@$(SILENT) || printf "$(MSG_COMPILING_CPP) $<" | $(AWK_CMD)
-	$(eval CMD=$(CC) -c $(ALL_CPPFLAGS) $< -o $@)
+$1/%.o : %.cpp | $(BEGIN)
+	@mkdir -p $$(@D)
+	@$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD)
+	$$(eval CMD=$$(CC) -c $$(ALL_CPPFLAGS) $$< -o $$@)
 	@$(BUILD_CMD)
 
+# Assemble: create object files from assembler source files.
+$1/%.o : %.S | $(BEGIN)
+	@mkdir -p $$(@D)
+	@$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
+	$$(eval CMD=$$(CC) -c $$(ALL_ASFLAGS) $$< -o $$@)
+	@$$(BUILD_CMD)
+
+endef
+
+# Since the object files could be in two different folders, generate
+# separate rules for them, rather than having too generic rules
+$(eval $(call GEN_OBJRULE,$(OBJDIR)))
+$(eval $(call GEN_OBJRULE,$(KBOBJDIR)))
+
 # Compile: create assembler files from C source files.
 %.s : %.c | $(BEGIN)
 	@$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
@@ -396,13 +419,6 @@ $(OBJDIR)/%.o : %.cpp | $(BEGIN)
 	$(eval CMD=$(CC) -S $(ALL_CPPFLAGS) $< -o $@)
 	@$(BUILD_CMD)
 
-# Assemble: create object files from assembler source files.
-$(OBJDIR)/%.o : %.S | $(BEGIN)
-	@mkdir -p $(@D)
-	@$(SILENT) || printf "$(MSG_ASSEMBLING) $<" | $(AWK_CMD)
-	$(eval CMD=$(CC) -c $(ALL_ASFLAGS) $< -o $@)
-	@$(BUILD_CMD)
-
 # Create preprocessed source for use in sending a bug report.
 %.i : %.c | $(BEGIN)
 	$(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
@@ -486,7 +502,7 @@ $(shell mkdir $(BUILD_DIR) 2>/dev/null)
 
 # Create object files directory
 $(shell mkdir $(OBJDIR) 2>/dev/null)
-
+$(shell mkdir $(KBOBJDIR) 2>/dev/null)
 
 # Include the dependency files.
 -include $(shell mkdir $(BUILD_DIR)/.dep 2>/dev/null) $(wildcard $(BUILD_DIR)/.dep/*)
-- 
cgit v1.2.3


From f11a0275a8e11a9e8393d8d64b45b62a1a018512 Mon Sep 17 00:00:00 2001
From: Fred Sundvik <fsundvik@gmail.com>
Date: Sun, 31 Jul 2016 13:24:25 +0300
Subject: Enable vpath seraching for source files only

---
 tmk_core/rules.mk | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

(limited to 'tmk_core')

diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index c81fa68541..f6819d7c31 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -15,6 +15,16 @@
 # Carlos Lamas
 #
 
+# Enable vpath seraching for source files only
+# Without this, output files, could be read from the wrong .build directories
+VPATH_SRC := $(VPATH)
+vpath %.c $(VPATH_SRC)
+vpath %.h $(VPATH_SRC)
+vpath %.cpp $(VPATH_SRC)
+vpath %.hpp $(VPATH_SRC)
+vpath %.S $(VPATH_SRC)
+VPATH :=
+
 
 # Output format. (can be srec, ihex, binary)
 FORMAT = ihex
@@ -71,7 +81,7 @@ BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [
 #     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))
+EXTRAINCDIRS += $(subst :, ,$(VPATH_SRC))
 
 
 # Compiler flag to set the C Standard level.
-- 
cgit v1.2.3


From e58e9af2ab2c0e66a8456b48d46f4d71a66af27a Mon Sep 17 00:00:00 2001
From: Fred Sundvik <fsundvik@gmail.com>
Date: Sat, 30 Jul 2016 18:16:34 +0300
Subject: More reliable .d file generation

Also generated inside the obj dir instead of separate deps folder.
---
 tmk_core/rules.mk | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

(limited to 'tmk_core')

diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index f6819d7c31..8acb439321 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -278,7 +278,7 @@ LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst
 
 # Compiler flags to generate dependency files.
 #GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-GENDEPFLAGS = -MMD -MP -MF $(BUILD_DIR)/.dep/$(subst /,_,$(subst $(BUILD_DIR)/,,$@)).d
+GENDEPFLAGS = -MMD -MP -MF $(patsubst %.o,%.td,$@)
 
 
 # Combine all necessary flags and optional flags.
@@ -288,6 +288,8 @@ ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
 ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
 ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
 
+MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
+
 # Default target.
 all: build sizeafter
 
@@ -390,17 +392,17 @@ BEGIN = gccversion check_submodule sizebefore
 
 define GEN_OBJRULE
 # Compile: create object files from C source files.
-$1/%.o : %.c | $(BEGIN)
+$1/%.o : %.c $1/%.d | $(BEGIN)
 	@mkdir -p $$(@D)
 	@$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
-	$$(eval CMD=$$(CC) -c $$(ALL_CFLAGS) $$< -o $$@)
+	$$(eval CMD=$$(CC) -c $$(ALL_CFLAGS) $$< -o $$@ && $$(MOVE_DEP))
 	@$$(BUILD_CMD)
 
 # Compile: create object files from C++ source files.
-$1/%.o : %.cpp | $(BEGIN)
+$1/%.o : %.cpp $1/%.d | $(BEGIN)
 	@mkdir -p $$(@D)
 	@$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD)
-	$$(eval CMD=$$(CC) -c $$(ALL_CPPFLAGS) $$< -o $$@)
+	$$(eval CMD=$$(CC) -c $$(ALL_CPPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
 	@$(BUILD_CMD)
 
 # Assemble: create object files from assembler source files.
@@ -409,9 +411,15 @@ $1/%.o : %.S | $(BEGIN)
 	@$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
 	$$(eval CMD=$$(CC) -c $$(ALL_ASFLAGS) $$< -o $$@)
 	@$$(BUILD_CMD)
-
 endef
 
+# We have to use static rules for the .d files for some reason
+DEPS = $(patsubst %.o,%.d,$(OBJ))
+# Keep the .d files
+.PRECIOUS: $(DEPS)
+# Empty rule to force recompilation if the .d file is missing
+$(DEPS):
+
 # Since the object files could be in two different folders, generate
 # separate rules for them, rather than having too generic rules
 $(eval $(call GEN_OBJRULE,$(OBJDIR)))
@@ -434,7 +442,7 @@ $(eval $(call GEN_OBJRULE,$(KBOBJDIR)))
 	$(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
 
 # Target: clean project.
-clean: 
+clean:
 
 show_path:
 	@echo VPATH=$(VPATH)
@@ -515,7 +523,7 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
 $(shell mkdir $(KBOBJDIR) 2>/dev/null)
 
 # Include the dependency files.
--include $(shell mkdir $(BUILD_DIR)/.dep 2>/dev/null) $(wildcard $(BUILD_DIR)/.dep/*)
+-include $(patsubst %.o,%.d,$(OBJ))
 
 
 # Listing of phony targets.
-- 
cgit v1.2.3


From 84bfb195545b0ba527f34c386d15d6f732a28de7 Mon Sep 17 00:00:00 2001
From: Fred Sundvik <fsundvik@gmail.com>
Date: Sat, 30 Jul 2016 22:07:01 +0300
Subject: Force compilation and linking when options changes

---
 tmk_core/rules.mk | 37 ++++++++++++++++++++++++++++---------
 1 file changed, 28 insertions(+), 9 deletions(-)

(limited to 'tmk_core')

diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index 8acb439321..ebcd372cac 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -284,8 +284,8 @@ GENDEPFLAGS = -MMD -MP -MF $(patsubst %.o,%.td,$@)
 # Combine all necessary flags and optional flags.
 # Add target processor to flags.
 # You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
-ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
-ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
+ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(EXTRAFLAGS)
+ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(EXTRAFLAGS)
 ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
 
 MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
@@ -385,32 +385,51 @@ BEGIN = gccversion check_submodule sizebefore
 # Link: create ELF output file from object files.
 .SECONDARY : $(BUILD_DIR)/$(TARGET).elf
 .PRECIOUS : $(OBJ)
-%.elf: $(OBJ) | $(BEGIN)
+# Note the obj.txt depeendency is there to force linking if a source file is deleted
+%.elf: $(OBJ) $(OBJDIR)/cflags.txt $(OBJDIR)/ldflags.txt $(OBJDIR)/obj.txt | $(BEGIN)
 	@$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
-	$(eval CMD=$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS))
+	$(eval CMD=$(CC) $(ALL_CFLAGS) $(filter-out %.txt,$^) --output $@ $(LDFLAGS))
 	@$(BUILD_CMD)
 
 define GEN_OBJRULE
 # Compile: create object files from C source files.
-$1/%.o : %.c $1/%.d | $(BEGIN)
+$1/%.o : %.c $1/%.d $1/cflags.txt | $(BEGIN)
 	@mkdir -p $$(@D)
 	@$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
-	$$(eval CMD=$$(CC) -c $$(ALL_CFLAGS) $$< -o $$@ && $$(MOVE_DEP))
+	$$(eval CMD=$$(CC) -c $$(ALL_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
 	@$$(BUILD_CMD)
 
 # Compile: create object files from C++ source files.
-$1/%.o : %.cpp $1/%.d | $(BEGIN)
+$1/%.o : %.cpp $1/%.d $1/cppflags.txt | $(BEGIN)
 	@mkdir -p $$(@D)
 	@$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD)
-	$$(eval CMD=$$(CC) -c $$(ALL_CPPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
+	$$(eval CMD=$$(CC) -c $$(ALL_CPPFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
 	@$(BUILD_CMD)
 
 # Assemble: create object files from assembler source files.
-$1/%.o : %.S | $(BEGIN)
+$1/%.o : %.S $1/asflags.txt | $(BEGIN)
 	@mkdir -p $$(@D)
 	@$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
 	$$(eval CMD=$$(CC) -c $$(ALL_ASFLAGS) $$< -o $$@)
 	@$$(BUILD_CMD)
+
+$1/force:
+
+$1/cflags.txt: $1/force
+	echo '$$(ALL_CFLAGS)' | cmp -s - $$@ || echo '$$(ALL_CFLAGS)' > $$@
+
+$1/cppflags.txt: $1/force
+	echo '$$(ALL_CPPFLAGS)' | cmp -s - $$@ || echo '$$(ALL_CPPFLAGS)' > $$@
+
+$1/asflags.txt: $1/force
+	echo '$$(ALL_ASFLAGS)' | cmp -s - $$@ || echo '$$(ALL_ASFLAGS)' > $$@
+
+$1/ldflags.txt: $1/force
+	echo '$$(LDFLAGS)' | cmp -s - $$@ || echo '$$(LDFLAGS)' > $$@
+
+$1/obj.txt: $1/force
+	echo '$$(OBJ)' | cmp -s - $$@ || echo '$$(OBJ)' > $$@
+
 endef
 
 # We have to use static rules for the .d files for some reason
-- 
cgit v1.2.3


From d5a947b32495625970d220349ca8f47e4cb2992a Mon Sep 17 00:00:00 2001
From: Fred Sundvik <fsundvik@gmail.com>
Date: Sun, 31 Jul 2016 13:49:04 +0300
Subject: Also depend on the gcc version

---
 tmk_core/rules.mk | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'tmk_core')

diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index ebcd372cac..69f82dc836 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -393,21 +393,21 @@ BEGIN = gccversion check_submodule sizebefore
 
 define GEN_OBJRULE
 # Compile: create object files from C source files.
-$1/%.o : %.c $1/%.d $1/cflags.txt | $(BEGIN)
+$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)
 	@mkdir -p $$(@D)
 	@$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
 	$$(eval CMD=$$(CC) -c $$(ALL_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
 	@$$(BUILD_CMD)
 
 # Compile: create object files from C++ source files.
-$1/%.o : %.cpp $1/%.d $1/cppflags.txt | $(BEGIN)
+$1/%.o : %.cpp $1/%.d $1/cppflags.txt $1/compiler.txt | $(BEGIN)
 	@mkdir -p $$(@D)
 	@$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD)
 	$$(eval CMD=$$(CC) -c $$(ALL_CPPFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
 	@$(BUILD_CMD)
 
 # Assemble: create object files from assembler source files.
-$1/%.o : %.S $1/asflags.txt | $(BEGIN)
+$1/%.o : %.S $1/asflags.txt $1/compiler.txt | $(BEGIN)
 	@mkdir -p $$(@D)
 	@$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
 	$$(eval CMD=$$(CC) -c $$(ALL_ASFLAGS) $$< -o $$@)
@@ -430,6 +430,8 @@ $1/ldflags.txt: $1/force
 $1/obj.txt: $1/force
 	echo '$$(OBJ)' | cmp -s - $$@ || echo '$$(OBJ)' > $$@
 
+$1/compiler.txt: $1/force
+	$$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@
 endef
 
 # We have to use static rules for the .d files for some reason
-- 
cgit v1.2.3


From a0dc6221993b10834dd55f58057d3354ca0910c3 Mon Sep 17 00:00:00 2001
From: Fred Sundvik <fsundvik@gmail.com>
Date: Sun, 31 Jul 2016 14:17:32 +0300
Subject: Remove the quick commands and add proper clean

---
 tmk_core/rules.mk | 31 +++++--------------------------
 1 file changed, 5 insertions(+), 26 deletions(-)

(limited to 'tmk_core')

diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index 69f82dc836..d2350f27c1 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -45,11 +45,6 @@ ifeq ($(COLOR),true)
 	BOLD=\033[1m
 endif
 
-ifdef quick
-	QUICK = $(quick)
-endif
-
-QUICK ?= false
 AUTOGEN ?= false
 
 ifneq ($(shell awk --version 2>/dev/null),)
@@ -293,9 +288,6 @@ MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
 # Default target.
 all: build sizeafter
 
-# Quick make that doesn't clean
-quick: build sizeafter
-
 # Change the build target to build a HEX file or a library.
 build: elf hex
 #build: elf hex eep lss sym
@@ -464,6 +456,9 @@ $(eval $(call GEN_OBJRULE,$(KBOBJDIR)))
 
 # Target: clean project.
 clean:
+	$(REMOVE) -r $(OBJDIR) 2>/dev/null
+	$(REMOVE) -r $(KBOBJDIR) 2>/dev/null
+	$(REMOVE) $(BUILD_DIR)/$(TARGET).*
 
 show_path:
 	@echo VPATH=$(VPATH)
@@ -483,7 +478,6 @@ all-keyboards-defaults: all-keyboards-defaults-all
 
 KEYBOARDS := $(SUBDIRS:$(TOP_DIR)/keyboards/%/=/keyboards/%)
 all-keyboards-all: $(addsuffix -all,$(KEYBOARDS))
-all-keyboards-quick: $(addsuffix -quick,$(KEYBOARDS))
 all-keyboards-clean: $(addsuffix -clean,$(KEYBOARDS))
 all-keyboards: all-keyboards-all
 
@@ -500,12 +494,10 @@ done
 endef
 
 define make_keyboard_helper
-# Just remove the -quick, -all and so on from the first argument and pass it forward
+# Just remove the -all and so on from the first argument and pass it forward
 $(call make_keyboard,$(subst -$2,,$1),$2)
 endef
 
-/keyboards/%-quick:
-	$(call make_keyboard_helper,$@,quick)
 /keyboards/%-all:
 	$(call make_keyboard_helper,$@,all)
 /keyboards/%-clean:
@@ -523,19 +515,6 @@ all-keymaps-%:
 
 all-keymaps: all-keymaps-all
 
-GOAL=$(MAKECMDGOALS)
-ifeq ($(MAKECMDGOALS),)
-GOAL = all
-endif
-CLEANING_GOALS=clean clean_list all
-ifneq ($(findstring $(GOAL),$(CLEANING_GOALS)),)
-$(shell $(REMOVE) -r $(BUILD_DIR) 2>/dev/null)
-$(shell $(REMOVE) -r $(TOP_DIR)/$(BUILD_DIR))
-$(shell $(REMOVE) -r $(KEYBOARD_PATH)/$(BUILD_DIR))
-$(shell if $$SUBPROJECT; then $(REMOVE) -r $(SUBPROJECT_PATH)/$(BUILD_DIR); fi)
-$(shell $(REMOVE) -r $(KEYMAP_PATH)/$(BUILD_DIR))
-endif
-
 # Create build directory
 $(shell mkdir $(BUILD_DIR) 2>/dev/null)
 
@@ -548,7 +527,7 @@ $(shell mkdir $(KBOBJDIR) 2>/dev/null)
 
 
 # Listing of phony targets.
-.PHONY : all quick finish sizebefore sizeafter gccversion \
+.PHONY : all finish sizebefore sizeafter gccversion \
 build elf hex eep lss sym coff extcoff check_submodule \
 clean clean_list debug gdb-config show_path \
 program teensy dfu flip dfu-ee flip-ee dfu-start \
-- 
cgit v1.2.3