diff --git a/HISTORY.md b/HISTORY.md index 72820d3..8c24017 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -10,6 +10,7 @@ The following is the rough list of changes that went into different versions. I - Remove "utility" from example makefiles. Fix issue #84 - Auto detect alternate core path from sketchbook folder. Fix issue #86 - Remove redundant checks for ARDUINO_DIR +- Improve avrdude and avrdude.conf path auto detection. Fix issue #48 ### 0.12.0 (2013-06-20) - Fix "generated_assembly" target, which got broken earlier. Fix issue #76 (https://github.com/matthijskooijman) diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 4943af0..3e98c9f 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -326,11 +326,27 @@ ifndef AVR_TOOLS_DIR AVR_TOOLS_DIR = $(BUNDLED_AVR_TOOLS_DIR) $(call show_config_variable,AVR_TOOLS_DIR,[BUNDLED],(in Arduino distribution)) - # if AVRDUDE_CONF is already defined, don't overwrite it - ifndef AVRDUDE_CONF - # The avrdude bundled with Arduino can't find it's config - AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf - endif + # In Linux distribution of Arduino, the path to avrdude and avrdude.conf are different + # More details at https://github.com/sudar/Arduino-Makefile/issues/48 and + # https://groups.google.com/a/arduino.cc/d/msg/developers/D_m97jGr8Xs/uQTt28KO_8oJ + ifeq ($(CURRENT_OS),LINUX) + + ifndef AVRDUDE + AVRDUDE = $(AVR_TOOLS_DIR)/../avrdude + endif + + ifndef AVRDUDE_CONF + AVRDUDE_CONF = $(AVR_TOOLS_DIR)/../avrdude.conf + endif + + else + + ifndef AVRDUDE_CONF + AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf + endif + + endif + else SYSTEMPATH_AVR_TOOLS_DIR := $(call dir_if_exists,$(abspath $(dir $(shell which avr-gcc))/..)) @@ -345,6 +361,10 @@ else $(call show_config_variable,AVR_TOOLS_DIR,[USER]) endif #ndef AVR_TOOLS_DIR +ifndef AVR_TOOLS_PATH + AVR_TOOLS_PATH = $(AVR_TOOLS_DIR)/bin +endif + ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries $(call show_config_variable,ARDUINO_LIB_PATH,[COMPUTED],(from ARDUINO_DIR)) ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino @@ -394,12 +414,6 @@ else endif -ifdef AVR_TOOLS_DIR - ifndef AVR_TOOLS_PATH - AVR_TOOLS_PATH = $(AVR_TOOLS_DIR)/bin - endif -endif - ######################################################################## # Makefile distribution path # @@ -881,19 +895,12 @@ $(OBJDIR)/%.sym: $(OBJDIR)/%.elf $(COMMON_DEPS) ######################################################################## # # Avrdude +# If avrdude is installed separately, it can find its own config file # ifndef AVRDUDE AVRDUDE = $(AVR_TOOLS_PATH)/avrdude endif -ifndef AVRDUDE_CONF - ifndef AVR_TOOLS_DIR - # The avrdude bundled with Arduino can't find its config - AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf - endif - # If avrdude is installed separately, it can find its own config file -endif - # Default avrdude options. -V Do not verify, -q - suppress progress output ifndef AVRDUDE_OPTS AVRDUDE_OPTS = -q -V