From 7ea8753b72ed7ddecdcb2db5b223ca920f8155b3 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Mon, 10 Jul 2017 13:46:39 +0300 Subject: [PATCH] Don't run dfu-programmer unless specified as a target This introduces a grep dependency, which I believe we didn't have before, but it should be available and installed by default on all the supported systems. --- tmk_core/avr.mk | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index ccecdb19..a36d219d 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -115,11 +115,11 @@ dfu: $(BUILD_DIR)/$(TARGET).hex sizeafter 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 - $(DFU_PROGRAMMER) $(MCU) erase -endif + if $(DFU_PROGRAMMER) --version 2>&1 | grep -q 0.7 ; then\ + $(DFU_PROGRAMMER) $(MCU) erase --force;\ + else\ + $(DFU_PROGRAMMER) $(MCU) erase;\ + fi $(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex $(DFU_PROGRAMMER) $(MCU) reset @@ -135,11 +135,11 @@ flip-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep $(REMOVE) $(BUILD_DIR)/$(TARGET)eep.hex dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep -ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1))) - $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep -else - $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep -endif + if $(DFU_PROGRAMMER) --version 2>&1 | grep -q 0.7 ; then\ + $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep;\ + else\ + $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep;\ + fi $(DFU_PROGRAMMER) $(MCU) reset # Convert hex to bin.