From 8896b8fcf60aea8ace1f2e08648dba5e1f60255f Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 5 Jul 2012 12:29:33 -0500 Subject: [PATCH] Autodetect arduino version when possible --- arduino-mk/Arduino.mk | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index ab83302..f3c22e4 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -292,8 +292,17 @@ endif # # Arduino version number 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 --bytes=3) +ifdef AUTO_ARDUINO_VERSION +$(info Using guessed/detected ARDUINO version define $(AUTO_ARDUINO_VERSION)) +ARDUINO_VERSION = $(AUTO_ARDUINO_VERSION) +else ARDUINO_VERSION = 100 endif +endif ######################################################################## # Arduino and system paths