Skip to content

Commit a5cacb1

Browse files
committed
Merge branch 'wip/avrlib-headers'
2 parents df88b48 + 77092fa commit a5cacb1

File tree

246 files changed

+480360
-40
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+480360
-40
lines changed

Makefile.common

+17-30
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ CFLAGS += -O2 -Wall -Wextra -Werror -Wno-unused-parameter \
4343
-Wno-unused-result -Wno-missing-field-initializers \
4444
-Wno-sign-compare
4545
CFLAGS += -g
46-
CORE_CFLAGS = -nostdinc -DAVR_CORE=1
46+
CORE_CFLAGS = -DAVR_CORE=1
4747

4848
ifeq (${shell uname}, Darwin)
4949
# gcc 4.2 from MacOS is really not up to scratch anymore
5050
CC = clang
5151
AVR_ROOT := "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/"
52-
AVR_INC := ${AVR_ROOT}/avr/
5352
AVR := ${AVR_ROOT}/bin/avr-
5453
# Thats for MacPorts libelf
5554
ifeq (${shell test -d /opt/local && echo Exists}, Exists)
@@ -62,7 +61,6 @@ ifeq (${shell uname}, Darwin)
6261
CC = clang
6362
IPATH += /opt/local/include /opt/local/include/libelf
6463
LFLAGS = -L/opt/local/lib/
65-
AVR_INC := /opt/local/avr
6664
AVR := /opt/local/bin/avr-
6765
else
6866
# That's for Homebrew libelf and avr-gcc support
@@ -79,17 +77,10 @@ ifeq (${shell uname}, Darwin)
7977
LFLAGS = -L$(HOMEBREW_PREFIX)/lib/
8078
CFLAGS += -I/$(HOMEBREW_PREFIX)/include/libelf
8179
AVR_ROOT := $(firstword $(wildcard $(HOMEBREW_PREFIX)/Cellar/avr-libc/*/))
82-
AVR_INC := ${AVR_ROOT}/avr
8380
AVR := $(HOMEBREW_PREFIX)/bin/avr-
8481
endif
8582
endif
8683
else
87-
LINUX_AVR_ROOTS := /usr/lib/avr /usr/avr /opt/cross/avr/avr /usr/local/avr
88-
AVR_ROOT := $(firstword $(wildcard $(LINUX_AVR_ROOTS)))
89-
ifeq (${AVR_ROOT},)
90-
$(error No avr-libc root directory found. Tried the following paths: $(LINUX_AVR_ROOTS))
91-
endif
92-
AVR_INC := ${AVR_ROOT}
9384
AVR := avr-
9485
endif
9586

@@ -98,7 +89,6 @@ endif
9889

9990
ifeq (${WIN}, Msys)
10091
AVR_ROOT := ${shell echo "${AVR32_HOME}" | tr '\\' '/'}
101-
AVR_INC := ${AVR_ROOT}/avr
10292
AVR := ${AVR_ROOT}/bin/avr-
10393
IPATH += ${PREFIX}/include
10494
CFLAGS += -I${PREFIX}/include
@@ -111,7 +101,7 @@ endif
111101
CPPFLAGS += --std=gnu99 -Wall
112102
CPPFLAGS += ${patsubst %,-I%,${subst :, ,${IPATH}}}
113103

114-
AVR_CPPFLAGS= ${CPPFLAGS} -idirafter ${AVR_INC}/include
104+
AVR_CPPFLAGS = ${CPPFLAGS} -I${SIMAVR}/cores
115105

116106
CC ?= clang
117107
AR ?= ar
@@ -141,6 +131,12 @@ LFLAGS += -Wl,-rpath,${LIBDIR}
141131
endif
142132
endif
143133

134+
ifeq (${V}, 1)
135+
E =
136+
else
137+
E = @
138+
endif
139+
144140
# The code is compiled "optimized" to the max.
145141
#
146142
# The weird "-Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000"
@@ -170,34 +166,25 @@ endif
170166

171167
# this rule has precedence
172168
${OBJ}/sim_%.o : cores/sim_%.c
173-
ifeq ($(V),1)
174-
$(CC) $(CPPFLAGS) $(CFLAGS) $(CORE_CFLAGS) -MMD \
175-
${AVR_CPPFLAGS} \
176-
$< -c -o $@
177-
else
178-
@$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS) $(CORE_CFLAGS) -MMD \
179-
${AVR_CPPFLAGS} \
180-
$< -c -o $@
169+
ifneq ($(E),)
181170
@echo CORE $<
182171
endif
172+
${E}$(CC) $(CPPFLAGS) $(CFLAGS) $(CORE_CFLAGS) -MMD \
173+
${AVR_CPPFLAGS} \
174+
$< -c -o $@
183175

184176
${OBJ}/%.o: %.c
185-
ifeq ($(V),1)
186-
$(CC) $(CPPFLAGS) $(CFLAGS) -MMD \
187-
$< -c -o $@
188-
else
189-
@$(CC) $(CPPFLAGS) $(CFLAGS) -MMD \
190-
$< -c -o $@
177+
ifneq ($(E),)
191178
@echo CC $<
192179
endif
180+
${E}$(CC) $(CPPFLAGS) $(CFLAGS) -MMD \
181+
$< -c -o $@
193182

194183
${OBJ}/%.elf:
195-
ifeq ($(V),1)
196-
$(CC) -MMD ${CFLAGS} ${LFLAGS} -o $@ $^ $(LDFLAGS)
197-
else
184+
ifneq ($(E),)
198185
@echo LD $@
199-
@$(CC) -MMD ${CFLAGS} ${LFLAGS} -o $@ $^ $(LDFLAGS)
200186
endif
187+
${E}$(CC) -MMD ${CFLAGS} ${LFLAGS} -o $@ $^ $(LDFLAGS)
201188

202189
obj: ${OBJ}
203190

simavr/Makefile

+7-9
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,28 @@ IPATH += ../../shared
5050
# Static library
5151
#
5252
${OBJ}/libsimavr.a : ${sim_o}
53-
ifeq ($(V),1)
54-
$(AR) cru $@ $^ && $(RANLIB) $@
55-
else
53+
ifneq ($(E),)
5654
@echo AR $@
57-
@$(AR) cru $@ $^ && $(RANLIB) $@
5855
endif
56+
${E}$(AR) cru $@ $^ && $(RANLIB) $@
5957

6058
#
6159
# Shared library (Linux)
6260
#
6361
${OBJ}/libsimavr.so.1 : ${sim_o}
64-
ifeq ($(V),1)
65-
$(CC) -shared -Wl,-soname,libsimavr.so.1 -o $@ $^ ${filter-out -lsimavr, $(LDFLAGS)}
66-
else
62+
ifneq ($(E),)
6763
@echo SHARED $@
68-
@$(CC) -shared -Wl,-soname,libsimavr.so.1 -o $@ $^ ${filter-out -lsimavr, $(LDFLAGS)}
6964
endif
65+
${E}$(CC) -shared -Wl,-soname,libsimavr.so.1 -o $@ $^ \
66+
${filter-out -lsimavr, $(LDFLAGS)}
7067

7168
${OBJ}/libsimavr.so : ${OBJ}/libsimavr.so.1
7269
ln -sf libsimavr.so.1 $@
7370

7471
libsimavr : config ${OBJ}/libsimavr.a
7572
# shared library won't work that easily on non-linux
7673
ifeq (${shell uname}, Linux)
77-
libsimavr : ${OBJ}/libsimavr.so
74+
libsimavr : ${OBJ}/libsimavr.so
7875
endif
7976

8077
${OBJ}/${target}.elf : ${OBJ}/${target}.o
@@ -166,6 +163,7 @@ sim_core_config.h ${OBJ}/cores.deps: $(cores) Makefile
166163
printf "\$${OBJ}/libsimavr.a: \$${OBJ}/$$obj\n">>${OBJ}/cores.deps ; \
167164
printf "\$${OBJ}/libsimavr.so.1: \$${OBJ}/$$obj\n">>${OBJ}/cores.deps ; \
168165
else \
166+
conf+="#undef CONFIG_$$upper\n"; \
169167
echo WARNING $$file did not compile, check your avr-gcc toolchain; \
170168
fi \
171169
done ; \

0 commit comments

Comments
 (0)