avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] address@hidden ... what is it for ?!


From: Vincent Trouilliez
Subject: Re: [avr-gcc-list] address@hidden ... what is it for ?!
Date: Tue, 6 Jan 2009 19:20:54 +0100

On Mon, 5 Jan 2009 23:26:13 +0100
Sascha Silbe <address@hidden> wrote:
> Sounds like you copied something from an obfuscating mailing list web 
> archive into your Makefile, probably with improperly wrapped lines. 
> Inspect your Makefile closely.

I copied my Makefile below, if someone wants to have a look ?
I got it from David Kelly on this list (hi Dave...), several years ago,
always worked fine, so I don't know why it may be creating this
strange file today, weird.

Or maybe I "damaged" the file accidentally, and since I am no expert in
Makefile syntax, it's all mostly chinese to me ! :-/

--
Vince



#
#$Id: Makefile,v 1.37 2005/08/23 17:35:35 dkelly Exp $
#
CC= avr-gcc
#MCU=atmega8
#MCU=atmega16
MCU=atmega32
#MCU=atmega163
#MCU=atmega323
#MCU=atmega64
#MCU=atmega128

#CFLAGS= -O -gdwarf-2 -Wall -ffreestanding -mmcu=$(MCU)
CFLAGS= -O -g -Wall -ffreestanding -mmcu=$(MCU)


#  .eeprom section start must match here and in _eeprom.hex rule:
LDFLAGS= -Wl,-Map,address@hidden -Wl,--section-start=.eeprom=00810001
#-Wl, -u,vfprintf -lprintf_min 
#-Wl, -u,vfprintf -lprintf_flt -lm

.SUFFIXES:
.SUFFIXES: .c .o .bin .elf .hex .srec .cof .list

.c.o:
        $(CC) $(CFLAGS) -c $<

.elf.bin:
        avr-objcopy -R .eeprom -O binary $< $@


#  Note this GNU Make syntax is bass-ackwards from BSD suffix conversion
#  but it allows changing more than the suffix in generated target.

%_flash.hex: %.elf
        avr-objcopy -j .text -j .data -O ihex $< $@

%_eeprom.hex: %.elf
        avr-objcopy -j .eeprom --change-section-lma .eeprom=0 -O ihex
$< $@

#
#  This is a fun conversion, creates an assembly dump
#  including C source lines interspersed as comments.
#
.elf.list:
        avr-objdump -DS $< > $@

#  one per line makes diffs easier to read
SRCS = \
        main.c \
        lcd.c \
        menu.c \
        ui.c \
        kb.c \
        rs.c \
        k_line.c \
        encoder.c

OBJS = $(SRCS:.c=.o)

all:    object.elf object.list object_flash.hex object_eeprom.hex

object.elf: $(OBJS)
        $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS)
        avr-size $@

clean:
        rm -f *~ *.elf *.cof *.bin *.hex *.srec *.s *.o *.pdf *core
*.list *.map .depend

# BSD make automatically reads .depend if it exists
depend: clean $(SRCS)
        $(CC) -E -M $(SRCS) > .depend

# -include fails silently in GNU Make if .depend does not exist
# OTOH -include is not BSD Make compatible.
-include .depend




reply via email to

[Prev in Thread] Current Thread [Next in Thread]