From acd6232d387d87a39f10143f819d0106c0020b6e Mon Sep 17 00:00:00 2001 From: Bernard `Guyzmo` Pratz Date: Fri, 29 May 2015 20:46:33 +0100 Subject: [PATCH] added support for MacOSX homebrew Signed-off-by: Bernard `Guyzmo` Pratz --- Makefile.common | 50 ++++++++++++++++++++++++++++++++----------------- simavr/Makefile | 2 +- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/Makefile.common b/Makefile.common index 42c7004..cfdb37d 100644 --- a/Makefile.common +++ b/Makefile.common @@ -44,24 +44,41 @@ CFLAGS += -g CORE_CFLAGS = -nostdinc -DAVR_CORE=1 ifeq (${shell uname}, Darwin) -# gcc 4.2 from MacOS is really not up to scratch anymore -CC = clang -AVR_ROOT := "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/" -AVR_INC := ${AVR_ROOT}/avr-4/ -AVR := ${AVR_ROOT}/bin/avr- -# Thats for MacPorts libelf -ifeq (${shell test -d /opt/local && echo Exists}, Exists) -IPATH += /opt/local/include -LFLAGS = -L/opt/local/lib/ -endif + # gcc 4.2 from MacOS is really not up to scratch anymore + CC = clang + AVR_ROOT := "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/" + AVR_INC := ${AVR_ROOT}/avr/ + AVR := ${AVR_ROOT}/bin/avr- + # Thats for MacPorts libelf + ifeq (${shell test -d /opt/local && echo Exists}, Exists) + IPATH += /opt/local/include + LFLAGS = -L/opt/local/lib/ + else + # That's for Homebrew libelf and avr-gcc support + ifeq (${shell test -d /usr/local/Cellar && echo Exists}, Exists) + ifneq (${shell test -d /usr/local/Cellar/avr-gcc/ && echo Exists}, Exists) + $(error Please install avr-gcc: brew tap larsimmisch/avr ; brew install avr-gcc avr-libc) + endif + ifneq (${shell test -d /usr/local/Cellar/libelf/ && echo Exists}, Exists) + $(error Please install libelf: brew install libelf) + endif + CC = clang + IPATH += /usr/local/include /usr/local/include/libelf + LFLAGS = -L/usr/local/lib/ + AVR_ROOT := $(firstword $(wildcard /usr/local/Cellar/avr-gcc/*/)) + AVR_INC := ${AVR_ROOT}/avr + AVR := /usr/local/bin/avr- + endif + endif else -LINUX_AVR_ROOTS := /usr/lib/avr /usr/avr /opt/cross/avr/avr /usr/local/avr -AVR_ROOT := $(firstword $(wildcard $(LINUX_AVR_ROOTS))) -ifeq (${AVR_ROOT},) -$(error No avr-libc root directory found. Tried the following paths: $(LINUX_AVR_ROOTS)) + LINUX_AVR_ROOTS := /usr/lib/avr /usr/avr /opt/cross/avr/avr /usr/local/avr + AVR_ROOT := $(firstword $(wildcard $(LINUX_AVR_ROOTS))) + ifeq (${AVR_ROOT},) + $(error No avr-libc root directory found. Tried the following paths: $(LINUX_AVR_ROOTS)) + endif + AVR_INC := ${AVR_ROOT} + AVR := avr- endif -AVR_INC := ${AVR_ROOT} -AVR := avr- # FIXME uname -o doesn't work on bsd derivatives #WIN := ${shell uname -o} @@ -77,7 +94,6 @@ CFLAGS += -DNO_COLOR else CFLAGS += -fPIC endif -endif CPPFLAGS += --std=gnu99 -Wall CPPFLAGS += ${patsubst %,-I%,${subst :, ,${IPATH}}} diff --git a/simavr/Makefile b/simavr/Makefile index 93dfb35..1e95349 100644 --- a/simavr/Makefile +++ b/simavr/Makefile @@ -43,7 +43,7 @@ sim_o := ${patsubst sim/%.c, ${OBJ}/%.o, ${sim}} VPATH = cores VPATH += sim -IPATH = sim +IPATH += sim IPATH += . IPATH += ../../shared -- 2.39.5