2013-02-21 00:43:25 -04:00
|
|
|
################################################################################
|
|
|
|
# Tools
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Decide where we are going to look for tools
|
|
|
|
#
|
|
|
|
ifeq ($(SYSTYPE),Darwin)
|
|
|
|
# use the tools that come with Arduino
|
|
|
|
# use BWK awk
|
|
|
|
AWK = awk
|
2013-03-08 02:53:09 -04:00
|
|
|
FIND_TOOL = $(firstword $(wildcard $(addsuffix /$(1),$(TOOLPATH))))
|
2013-02-21 00:43:25 -04:00
|
|
|
endif
|
|
|
|
ifeq ($(SYSTYPE),Linux)
|
|
|
|
# expect that tools are on the path
|
|
|
|
TOOLPATH := $(subst :, ,$(PATH))
|
2013-03-08 02:53:09 -04:00
|
|
|
FIND_TOOL = $(firstword $(wildcard $(addsuffix /$(1),$(TOOLPATH))))
|
2013-02-21 00:43:25 -04:00
|
|
|
endif
|
2014-07-23 07:11:42 -03:00
|
|
|
ifeq ($(findstring CYGWIN, $(SYSTYPE)),CYGWIN)
|
2015-05-25 10:02:23 -03:00
|
|
|
TOOLPATH := $(subst :, ,$(PATH))
|
|
|
|
FIND_TOOL = $(firstword $(wildcard $(addsuffix /$(1).exe,$(TOOLPATH))))
|
2013-02-21 00:43:25 -04:00
|
|
|
endif
|
2014-07-23 07:11:42 -03:00
|
|
|
ifeq ($(findstring MINGW, $(SYSTYPE)),MINGW)
|
2014-12-03 16:42:53 -04:00
|
|
|
# expect that tools are on the path
|
|
|
|
TOOLPATH := $(subst :, ,$(PATH))
|
2013-03-08 02:53:09 -04:00
|
|
|
FIND_TOOL = $(firstword $(wildcard $(addsuffix /$(1).exe,$(TOOLPATH))))
|
2013-02-21 00:43:25 -04:00
|
|
|
endif
|
|
|
|
|
2013-03-03 07:22:33 -04:00
|
|
|
NATIVE_CXX := g++
|
|
|
|
NATIVE_CC := gcc
|
|
|
|
NATIVE_AS := gcc
|
|
|
|
NATIVE_AR := ar
|
|
|
|
NATIVE_LD := g++
|
|
|
|
NATIVE_GDB := gdb
|
|
|
|
NATIVE_OBJCOPY := objcopy
|
2013-02-21 00:43:25 -04:00
|
|
|
|
|
|
|
AVARICE := $(call FIND_TOOL,avarice)
|
|
|
|
|
2017-08-23 22:20:00 -03:00
|
|
|
# enable ccache if installed
|
|
|
|
CCACHE := $(call FIND_TOOL,ccache)
|
|
|
|
export CCACHE
|
2014-07-06 20:37:27 -03:00
|
|
|
|
2017-08-23 22:20:00 -03:00
|
|
|
# toolchain used for sitl-arm
|
2014-07-23 07:11:42 -03:00
|
|
|
RPI_CXX := arm-linux-gnueabihf-g++
|
|
|
|
RPI_CC := arm-linux-gnueabihf-gcc
|
|
|
|
RPI_AS := arm-linux-gnueabihf-gcc
|
|
|
|
RPI_AR := arm-linux-gnueabihf-ar
|
|
|
|
RPI_LD := arm-linux-gnueabihf-g++
|
|
|
|
RPI_GDB := arm-linux-gnueabihf-gdb
|
|
|
|
RPI_OBJCOPY := arm-linux-gnueabihf-obj
|
|
|
|
|
2014-07-06 20:53:31 -03:00
|
|
|
CXX = $(CCACHE) $($(TOOLCHAIN)_CXX)
|
|
|
|
CC = $(CCACHE) $($(TOOLCHAIN)_CC)
|
2013-02-21 00:43:25 -04:00
|
|
|
AS = $($(TOOLCHAIN)_AS)
|
|
|
|
AR = $($(TOOLCHAIN)_AR)
|
|
|
|
LD = $($(TOOLCHAIN)_LD)
|
|
|
|
GDB = $($(TOOLCHAIN)_GDB)
|
|
|
|
OBJCOPY = $($(TOOLCHAIN)_OBJCOPY)
|
|
|
|
|
2013-03-03 07:22:33 -04:00
|
|
|
ifeq ($(CXX),)
|
2013-05-04 02:10:20 -03:00
|
|
|
$(error ERROR: cannot find the compiler tools for $(TOOLCHAIN) anywhere on the path $(TOOLPATH))
|
2013-02-21 00:43:25 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Find awk
|
|
|
|
AWK ?= gawk
|
|
|
|
ifeq ($(shell which $(AWK)),)
|
|
|
|
$(error ERROR: cannot find $(AWK) - you may need to install GNU awk)
|
|
|
|
endif
|