From 4570a6e37e546fa40d59d6c7d2e9b8a2204b66e3 Mon Sep 17 00:00:00 2001 From: Michel Date: Sat, 26 Dec 2009 14:52:59 +0000 Subject: [PATCH] examples: Ported to Snow Leopard Uses OSX frameworks if applicable Signed-off-by: Michel Pollet --- Makefile.common | 1 + examples/board_ledramp/Makefile | 9 +++++++-- examples/board_ledramp/ledramp.c | 5 ++++- examples/board_simduino/Makefile | 9 +++++++-- examples/board_simduino/simduino.c | 4 ++++ examples/board_timer_64led/Makefile | 9 +++++++-- examples/board_timer_64led/timer_64led.c | 5 ++++- 7 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Makefile.common b/Makefile.common index 0949fb8..d4bab23 100644 --- a/Makefile.common +++ b/Makefile.common @@ -34,6 +34,7 @@ ifeq (${shell uname}, Darwin) AVR_ROOT := "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/" AVR_INC := ${AVR_ROOT}/avr-4/ AVR := ${AVR_ROOT}/bin/avr- +LFLAGS += -L/opt/local/lib else AVR_ROOT := /usr/lib/avr AVR_INC := ${AVR_ROOT} diff --git a/examples/board_ledramp/Makefile b/examples/board_ledramp/Makefile index e3ef7c6..bafabae 100644 --- a/examples/board_ledramp/Makefile +++ b/examples/board_ledramp/Makefile @@ -31,7 +31,12 @@ IPATH += ${simavr}/simavr/sim VPATH = . VPATH += ../parts -LDFLAGS += -lglut -lpthread +LDFLAGS += -lpthread +ifneq (${shell uname}, Darwin) +LDFLAGS += -lglut +else +LDFLAGS += -framework GLUT -framework OpenGL +endif all: obj ${firmware} ${board} @@ -40,7 +45,7 @@ include ${simavr}/Makefile.common ${board} : ${OBJ}/button.o ${board} : ${OBJ}/${board}.o @echo LD $@ - @gcc -MD ${CFLAGS} -o $@ $^ $(LDFLAGS) ${simavr}/simavr/libsimavr.a + @gcc -MD ${CFLAGS} ${LFLAGS} -o $@ $^ $(LDFLAGS) ${simavr}/simavr/libsimavr.a clean: rm -rf obj *.hex *.a *.axf ${board} *.vcd diff --git a/examples/board_ledramp/ledramp.c b/examples/board_ledramp/ledramp.c index 59fa967..5167c66 100644 --- a/examples/board_ledramp/ledramp.c +++ b/examples/board_ledramp/ledramp.c @@ -22,8 +22,11 @@ #include #include #include - +#if __APPLE__ +#include +#else #include +#endif #include #include "sim_avr.h" diff --git a/examples/board_simduino/Makefile b/examples/board_simduino/Makefile index 6d81178..ae18250 100644 --- a/examples/board_simduino/Makefile +++ b/examples/board_simduino/Makefile @@ -31,7 +31,12 @@ IPATH += ${simavr}/simavr/sim VPATH = . VPATH += ../parts -LDFLAGS += -lglut -lpthread +LDFLAGS += -lpthread +ifneq (${shell uname}, Darwin) +LDFLAGS += -lglut +else +LDFLAGS += -framework GLUT -framework OpenGL +endif all: obj ${firmware} ${board} @@ -41,7 +46,7 @@ ${board} : ${OBJ}/button.o ${board} : ${OBJ}/uart_udp.o ${board} : ${OBJ}/${board}.o @echo LD $@ - @gcc -MD ${CFLAGS} -o $@ $^ $(LDFLAGS) ${simavr}/simavr/libsimavr.a + @gcc -MD ${CFLAGS} ${LFLAGS} -o $@ $^ $(LDFLAGS) ${simavr}/simavr/libsimavr.a clean: rm -rf obj *.a *.axf ${board} *.vcd diff --git a/examples/board_simduino/simduino.c b/examples/board_simduino/simduino.c index 6a3dcdc..3152c48 100644 --- a/examples/board_simduino/simduino.c +++ b/examples/board_simduino/simduino.c @@ -28,7 +28,11 @@ #include #include +#if __APPLE__ +#include +#else #include +#endif #include #include "sim_avr.h" diff --git a/examples/board_timer_64led/Makefile b/examples/board_timer_64led/Makefile index 5eb60a2..ecc286f 100644 --- a/examples/board_timer_64led/Makefile +++ b/examples/board_timer_64led/Makefile @@ -31,7 +31,12 @@ IPATH += ${simavr}/simavr/sim VPATH = . VPATH += ../parts -LDFLAGS += -lglut -lpthread +LDFLAGS += -lpthread +ifneq (${shell uname}, Darwin) +LDFLAGS += -lglut +else +LDFLAGS += -framework GLUT -framework OpenGL +endif all: obj ${firmware} ${board} @@ -41,7 +46,7 @@ ${board} : ${OBJ}/button.o ${board} : ${OBJ}/hc595.o ${board} : ${OBJ}/${board}.o @echo LD $@ - @gcc -MD ${CFLAGS} -o $@ $^ $(LDFLAGS) ${simavr}/simavr/libsimavr.a + @gcc -MD ${CFLAGS} ${LFLAGS} -o $@ $^ $(LDFLAGS) ${simavr}/simavr/libsimavr.a clean: rm -rf obj *.hex *.a *.axf ${board} *.vcd diff --git a/examples/board_timer_64led/timer_64led.c b/examples/board_timer_64led/timer_64led.c index f85c285..567303c 100644 --- a/examples/board_timer_64led/timer_64led.c +++ b/examples/board_timer_64led/timer_64led.c @@ -22,8 +22,11 @@ #include #include #include - +#if __APPLE__ +#include +#else #include +#endif #include #include "sim_avr.h" -- 2.39.5