projects
/
simavr
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
misc: Github markdown uses underscores to italicize words
[simavr]
/
Makefile.common
diff --git
a/Makefile.common
b/Makefile.common
index
f781c16
..
e019689
100644
(file)
--- a/
Makefile.common
+++ b/
Makefile.common
@@
-5,7
+5,7
@@
#
# The code is compiled "optimized" to the max.
#
#
# The code is compiled "optimized" to the max.
#
-# The w
ie
rd "-Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000"
+# The w
ei
rd "-Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000"
# is used to tell the linker not to discard the .mmcu section,
# otherwise the --gc-sections will delete it.
#
# is used to tell the linker not to discard the .mmcu section,
# otherwise the --gc-sections will delete it.
#
@@
-26,22
+26,33
@@
# You should have received a copy of the GNU General Public License
# along with simavr. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU General Public License
# along with simavr. If not, see <http://www.gnu.org/licenses/>.
+# simavr directory
+SIMAVR ?= ${shell for p in . .. ../.. ../../..;do test -d $$p/simavr/sim && echo $$p/simavr; done}
+
+# You can override the build settings with local changes in this file
+# for example:
+# export CC=clang
+# export CFLAGS=-march=corei7-avx
+# etc
+-include ${wildcard ${SIMAVR}/../.make.options*}
+
# 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/'}
# 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/'}
-ifeq ($(ARCH), i)
-CFLAGS += -mfpmath=sse -msse2
-endif
-
-CFLAGS += -g --std=gnu99 -Wall
-CFLAGS += ${patsubst %,-I%,${subst :, ,${IPATH}}}
-LDFLAGS += -lelf
+CFLAGS += -O2 -Wall
+CFLAGS += -g
ifeq (${shell uname}, Darwin)
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-
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}
else
AVR_ROOT := /usr/lib/avr
AVR_INC := ${AVR_ROOT}
@@
-49,19
+60,24
@@
AVR := avr-
CFLAGS += -fPIC
endif
CFLAGS += -fPIC
endif
-CC ?= gcc
+CPPFLAGS += --std=gnu99 -Wall
+CPPFLAGS += ${patsubst %,-I%,${subst :, ,${IPATH}}}
+
+AVR_CPPFLAGS= ${CPPFLAGS} -idirafter ${AVR_INC}/include
+
+CC ?= clang
AR ?= ar
RANLIB ?= ranlib
MKDIR ?= mkdir -p
INSTALL ?= install
AR ?= ar
RANLIB ?= ranlib
MKDIR ?= mkdir -p
INSTALL ?= install
-
-# simavr directory
-SIMAVR ?= ${shell for p in . .. ../.. ../../..;do test -d $$p/simavr/sim && echo $$p/simavr; done}
+SHELL := ${shell which bash}
OBJ = obj-${shell $(CC) -dumpmachine}
LIBDIR = ${shell pwd}/${SIMAVR}/${OBJ}
LDFLAGS += -L${LIBDIR} -lsimavr
OBJ = obj-${shell $(CC) -dumpmachine}
LIBDIR = ${shell pwd}/${SIMAVR}/${OBJ}
LDFLAGS += -L${LIBDIR} -lsimavr
+LDFLAGS += -lelf
+
ifeq (${shell uname}, Linux)
# allow the shared library to be found in the build directory
LFLAGS += -Wl,-rpath,${LIBDIR}
ifeq (${shell uname}, Linux)
# allow the shared library to be found in the build directory
LFLAGS += -Wl,-rpath,${LIBDIR}
@@
-69,7
+85,7
@@
endif
# The code is compiled "optimized" to the max.
#
# The code is compiled "optimized" to the max.
#
-# The w
ie
rd "-Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000"
+# The w
ei
rd "-Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000"
# is used to tell the linker not to discard the .mmcu section,
# otherwise the --gc-sections will delete it.
# is used to tell the linker not to discard the .mmcu section,
# otherwise the --gc-sections will delete it.
@@
-97,22
+113,22
@@
endif
# this rule has precedence
${OBJ}/sim_%.o : cores/sim_%.c
ifeq ($(V),1)
# this rule has precedence
${OBJ}/sim_%.o : cores/sim_%.c
ifeq ($(V),1)
- $(CC) $(CFLAGS) -MMD \
-
-I${AVR_INC}/include/
\
+ $(CC) $(C
PPFLAGS) $(C
FLAGS) -MMD \
+
${AVR_CPPFLAGS}
\
$< -c -o $@
else
$< -c -o $@
else
- @$(CC) $(CFLAGS) -MMD \
-
-I${AVR_INC}/include/
\
+ @$(CC) $(C
PPFLAGS) $(CFLAGS) $(C
FLAGS) -MMD \
+
${AVR_CPPFLAGS}
\
$< -c -o $@
@echo CORE $<
endif
${OBJ}/%.o: %.c
ifeq ($(V),1)
$< -c -o $@
@echo CORE $<
endif
${OBJ}/%.o: %.c
ifeq ($(V),1)
- $(CC) $(CFLAGS) -MMD \
+ $(CC) $(C
PPFLAGS) $(C
FLAGS) -MMD \
$< -c -o $@
else
$< -c -o $@
else
- @$(CC) $(CFLAGS) -MMD \
+ @$(CC) $(C
PPFLAGS) $(C
FLAGS) -MMD \
$< -c -o $@
@echo CC $<
endif
$< -c -o $@
@echo CC $<
endif