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).
This commit is contained in:
Tim Niemueller 2017-03-06 17:44:29 +01:00
parent 31fb395ba0
commit 359159d6a6
2 changed files with 4 additions and 0 deletions

View file

@ -902,6 +902,9 @@ ifndef OVERRIDE_EXECUTABLES
AR = $(AVR_TOOLS_PATH)/$(AR_NAME) AR = $(AVR_TOOLS_PATH)/$(AR_NAME)
SIZE = $(AVR_TOOLS_PATH)/$(SIZE_NAME) SIZE = $(AVR_TOOLS_PATH)/$(SIZE_NAME)
NM = $(AVR_TOOLS_PATH)/$(NM_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 endif
REMOVE = rm -rf REMOVE = rm -rf

View file

@ -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) - Fix: Auto-detect F_CPU on Teensy from boards.txt (https://github.com/DaWelter)
- Tweak: Allow to disable LTO (currently crashes on Fedora 25) - Tweak: Allow to disable LTO (currently crashes on Fedora 25)
- Fix: find AVRDUDE_CONF for system avrdude - Fix: find AVRDUDE_CONF for system avrdude
- Fix: properly detect tool paths
### 1.5.2 (2017-01-11) ### 1.5.2 (2017-01-11)