summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2017-07-10 13:46:39 +0300
committerJack Humbert <jack.humb@gmail.com>2017-07-10 09:00:18 -0400
commit7ea8753b72ed7ddecdcb2db5b223ca920f8155b3 (patch)
tree91c736039a7dbf4f1819cfc44c6ecf1fc337d939
parentfcd08b8c7d66cf4cf5724b7b2468d3569488114f (diff)
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.
-rw-r--r--tmk_core/avr.mk20
1 files changed, 10 insertions, 10 deletions
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index ccecdb1929..a36d219dd0 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.