From 359159d6a6c0630ef17f818aef3e5857dd725a66 Mon Sep 17 00:00:00 2001 From: Tim Niemueller Date: Mon, 6 Mar 2017 17:44:29 +0100 Subject: [PATCH] Arduino.mk: verify guessed tool paths, use system ones if not found Currently all tool locations depend guessing the avr tools directory depending on the location of avr-gcc. While this works perfectly for seperate installations of those tools, it fails if using system-installed ones that are ccache enabled (as on Fedora). There, avr-gcc can be found in /usr/lib64/ccache/avr-gcc, then, it uses the parent directory and appends bin again, leading it to guess wrong paths for all tools. Add a line which verifies that valid tools have been found, and if not, try to identify proper ones by trying to find them in the PATH environment variable (or relying on shell features to do so). This change makes Arduino.mk work on ccache-enabled Fedora out-of-the-box (with the previous patch for disabling LTO that is). --- Arduino.mk | 3 +++ HISTORY.md | 1 + 2 files changed, 4 insertions(+) diff --git a/Arduino.mk b/Arduino.mk index 576494d..204677e 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -902,6 +902,9 @@ ifndef OVERRIDE_EXECUTABLES AR = $(AVR_TOOLS_PATH)/$(AR_NAME) SIZE = $(AVR_TOOLS_PATH)/$(SIZE_NAME) NM = $(AVR_TOOLS_PATH)/$(NM_NAME) + + # Check if the default exist, otherwise try to find in PATH + $(foreach C,CC CXX AS OBJCOPY OBJDUMP AR SIZE NM,$(if $(wildcard $C),,$(eval $C = $$(shell type -p $$($(C)_NAME))))) endif REMOVE = rm -rf diff --git a/HISTORY.md b/HISTORY.md index 9d394b5..a0e2e62 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -9,6 +9,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Fix: Auto-detect F_CPU on Teensy from boards.txt (https://github.com/DaWelter) - Tweak: Allow to disable LTO (currently crashes on Fedora 25) - Fix: find AVRDUDE_CONF for system avrdude +- Fix: properly detect tool paths ### 1.5.2 (2017-01-11)