aboutsummaryrefslogtreecommitdiff
path: root/arduino-mk/Arduino.mk
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2013-05-30 16:23:32 +0200
committerMatthijs Kooijman <matthijs@stdin.nl>2013-05-30 19:27:11 +0200
commit1329730dfef14bccf163457d1371abb201d76bf4 (patch)
tree4370cbf5fd40819f2bd3117831ba019207a191f2 /arduino-mk/Arduino.mk
parentae10f71dd4eb0143e3ec1740360a4f5c0005eee4 (diff)
Don't try to read version.txt when it does not exist
This can happen for example when the arduino directory is a checkout from git instead of a released version. Before, cat would show an error which is now prevented. The version still defaults to 100 just like before.
Diffstat (limited to 'arduino-mk/Arduino.mk')
-rw-r--r--arduino-mk/Arduino.mk3
1 files changed, 2 insertions, 1 deletions
diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk
index f068739..2fb5b10 100644
--- a/arduino-mk/Arduino.mk
+++ b/arduino-mk/Arduino.mk
@@ -392,7 +392,8 @@ ifndef ARDUINO_VERSION
# Remove all the decimals, and right-pad with zeros, and finally grab the first 3 bytes.
# Works for 1.0 and 1.0.1
- AUTO_ARDUINO_VERSION := $(shell cat $(ARDUINO_DIR)/lib/version.txt | sed -e 's/[.]//g' -e 's/$$/0000/' | head -c3)
+ VERSION_FILE := $(ARDUINO_DIR)/lib/version.txt
+ AUTO_ARDUINO_VERSION := $(shell [ -e $(VERSION_FILE) ] && cat $(VERSION_FILE) | sed -e 's/[.]//g' -e 's/$$/0000/' | head -c3)
ifdef AUTO_ARDUINO_VERSION
ARDUINO_VERSION = $(AUTO_ARDUINO_VERSION)
$(call show_config_variable,ARDUINO_VERSION,[AUTODETECTED])