From 0620d0c6317fa7cf25547e96199560a6604e3fa0 Mon Sep 17 00:00:00 2001 From: DrZiplok Date: Thu, 30 Dec 2010 02:25:55 +0000 Subject: [PATCH] We need TOOLPATH even when ARDUINO is defined. Refactor. git-svn-id: https://arducopter.googlecode.com/svn/trunk@1366 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- libraries/AP_Common/Arduino.mk | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libraries/AP_Common/Arduino.mk b/libraries/AP_Common/Arduino.mk index a1495a0c49..0c0eb1ef48 100644 --- a/libraries/AP_Common/Arduino.mk +++ b/libraries/AP_Common/Arduino.mk @@ -68,10 +68,6 @@ SKETCH := $(lastword $(subst /, ,$(SRCROOT))) TMPDIR ?= /tmp BUILDROOT := $(abspath $(TMPDIR)/$(SKETCH).build) -# -# Prefer the compiler bundled with Arduino on e.g. Mac OS. -# - # # Find Arduino, if not explicitly specified # @@ -87,14 +83,11 @@ ifeq ($(ARDUINO),) ifeq ($(ARDUINOS),) $(error ERROR: Spotlight cannot find Arduino on your system.) endif - # use the compiler that comes with Arduino - TOOLPATH := $(ARDUINOS)/hardware/tools/avr/bin endif ifeq ($(SYSTYPE),Linux) ARDUINO_SEARCHPATH = /usr/share/arduino /usr/local/share/arduino ARDUINOS := $(wildcard $(ARDUINO_SEARCHPATH)) - TOOLPATH := $(subst :, ,$(PATH)) endif # @@ -118,8 +111,17 @@ endif # # -# XXX should we be using tools from the Arduino distribution? +# Decide where we are going to look for tools # +ifeq ($(SYSTYPE),Darwin) + # use the tools that come with Arduino + TOOLPATH := $(ARDUINOS)/hardware/tools/avr/bin +endif +ifeq ($(SYSTYPE),Linux) + # expect that tools are on the path + TOOLPATH := $(subst :, ,$(PATH)) +endif + FIND_TOOL = $(firstword $(wildcard $(addsuffix /$(1),$(TOOLPATH)))) CXX = $(call FIND_TOOL,avr-g++) CC = $(call FIND_TOOL,avr-gcc)