Makefile: Bit more cleanup
[simavr] / Makefile.common
index d476d83..75f687c 100644 (file)
@@ -29,6 +29,7 @@
 # get the first character of what the compiler says it is, unless it's 'x86_64' doh
 ARCH           = ${shell $(CC) -dumpmachine | sed -e 's/^x/i/' -e 's/\(.\).*/\1/'}
 
+CFLAGS         += -O2 -Wall
 ifeq ($(ARCH), i)
 CFLAGS         += -mfpmath=sse -msse2
 endif
@@ -40,7 +41,11 @@ 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
+# Thats for MacPorts libelf
+ifeq (${shell test -d /opt/local && echo Exists}, Exists)
+IPATH          += /opt/local/include
+LFLAGS         = -L/opt/local/lib/
+endif
 else
 AVR_ROOT       := /usr/lib/avr
 AVR_INC        := ${AVR_ROOT}
@@ -53,6 +58,7 @@ AR                    ?= ar
 RANLIB                 ?= ranlib
 MKDIR          ?= mkdir -p
 INSTALL                ?= install
+SHELL          := ${shell which bash}
 
 # simavr directory
 SIMAVR         ?= ${shell for p in . .. ../.. ../../..;do test -d $$p/simavr/sim && echo $$p/simavr; done}