From 5f2fe2466b5a69ca24dee3a3ca99742f412bf8fc Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Mon, 14 Dec 2009 20:54:27 +0000 Subject: [PATCH] Cleanup of the Makefiles General cleanup, updated comments Signed-off-by: Michel Pollet --- Makefile.common | 38 ++++++++++++++++++++++---------------- simavr/Makefile | 9 ++++----- tests/Makefile | 5 ----- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Makefile.common b/Makefile.common index 77b1ad3..0949fb8 100644 --- a/Makefile.common +++ b/Makefile.common @@ -40,26 +40,32 @@ AVR_INC := ${AVR_ROOT} AVR := avr- endif +# The code is compiled "optimized" to the max. +# +# The wierd "-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. + %.hex: %.axf - @${AVR}objcopy -j .text -j .data -O ihex ${<} ${@} + @${AVR}objcopy -j .text -j .data -O ihex ${<} ${@} %.s: %.axf - @${AVR}objdump -j .text -j .data -j .bss -d ${<} > ${@} + @${AVR}objdump -j .text -j .data -j .bss -d ${<} > ${@} -# --mcall-prologues +# --mcall-prologues can be used here, but messes up debugging a little %.axf: %.c - @echo AVR-CC ${<} - @part=${<} ; part=$${part/_*}; \ - ${AVR}gcc -Wall -gdwarf-2 -Os -std=gnu99 \ - -mmcu=$$part \ - -DF_CPU=8000000 \ - -fno-inline-small-functions \ - -ffunction-sections -fdata-sections \ - -Wl,--relax,--gc-sections \ - -Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000 \ - -I../include -I../../include \ - ${<} -o ${@} - @${AVR}size ${@}|sed '1d' + @echo AVR-CC ${<} + @part=${<} ; part=$${part/_*}; \ + ${AVR}gcc -Wall -gdwarf-2 -Os -std=gnu99 \ + -mmcu=$$part \ + -DF_CPU=8000000 \ + -fno-inline-small-functions \ + -ffunction-sections -fdata-sections \ + -Wl,--relax,--gc-sections \ + -Wl,--undefined=_mmcu,--section-start=.mmcu=0x910000 \ + -I../include -I../../include \ + ${<} -o ${@} + @${AVR}size ${@}|sed '1d' OBJ = obj @@ -69,7 +75,7 @@ ${OBJ}/%.o: %.c @echo CC $< ${OBJ}: - mkdir -p ${OBJ} + @mkdir -p ${OBJ} # include the dependency files generated by gcc, if any -include ${wildcard ${OBJ}/*.d} diff --git a/simavr/Makefile b/simavr/Makefile index ab80a90..713fd76 100644 --- a/simavr/Makefile +++ b/simavr/Makefile @@ -25,16 +25,15 @@ cores_o = ${patsubst cores/%.c, obj/%.o, ${cores}} sim = ${wildcard sim/sim_*.c} ${wildcard sim/avr_*.c} sim_o = ${patsubst sim/%.c, obj/%.o, ${sim}} -VPATH = . -VPATH += cores +VPATH = cores VPATH += sim -IPATH = . -IPATH += sim +IPATH = sim IPATH += ../../shared IPATH += ../include -IPATH += /opt/local/include +# Thats for MacPorts libelf +IPATH += /opt/local/include LFLAGS = -L/opt/local/lib/ all: obj libsimavr.a ${target} diff --git a/tests/Makefile b/tests/Makefile index 900ad75..68db33c 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -3,11 +3,6 @@ # And compile it into an ELF binary. # It also disassemble it for debugging purposes. # -# The code is compiled "optimized" to the max. -# -# The wierd "-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. # # Copyright 2008, 2009 Michel Pollet # -- 2.39.5