Getting multiple intermediate files out of gcc with build rules
Getting multiple intermediate files out of gcc with build rules
- Subject: Getting multiple intermediate files out of gcc with build rules
- From: Rick Mann <email@hidden>
- Date: Thu, 9 Feb 2006 02:29:45 -0800
So, I think I got it to build .o files. However, there are a number
of files I actually need to build. Do I need separate targets for
this? Perhaps if I include my current Makefile, it will make more
sense. I've copied it below.
There are several files that get build from a single .c file. (I'm
not sure what happens when more .c files get added to the mix).
Starting with main.c, the makefile below, default target, produces
main.elf*
main.hex
main.lst
main.map
main.o
main.out*
TIA!
--
Rick
CC=avr-g++
OBJCOPY=avr-objcopy
TARGET=main
FILE=$(TARGET).hex
OBJ=$(TARGET).o
OPT=-Os
MCU=atmega32
SERIAL=$(shell ls /dev/tty.KeySerial*)
SERIAL_AVRDUDE=$(shell /dev/cu.USA)
CFLAGS= -g -mmcu=$(MCU) $(OPT) \
-funsigned-char -funsigned-bitfields -fpack-struct \
-fshort-enums -Wall \
-Wa,-ahlms=$(<:.c=.lst)
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
all : $(TARGET).o $(TARGET).out $(TARGET).elf $(TARGET).hex
$(TARGET).o : $(TARGET).c
$(CC) $(CFLAGS) -Os -c $(TARGET).c
$(TARGET).hex : $(TARGET).out
$(OBJCOPY) -j .text -O ihex $(TARGET).out $(TARGET).hex
$(TARGET).out : $(TARGET).elf
$(CC) $(CFLAGS) -o $(TARGET).out -Wl,-Map,$(TARGET).map $(TARGET).o
$(TARGET).elf : $(TARGET).o
$(CC) $(CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
clean :
rm -f $(TARGET).o $(TARGET).out $(TARGET).map \
$(TARGET).lst $(TARGET).hex $(TARGET) $(TARGET).elf
# --jtag-bitrate 250KHz
jtag :
avarice --erase --program --file $(TARGET).elf --mkII --jtag $
(SERIAL) :4242
gdb :
echo "(gdb) target remote localhost:4242"
avr-gdb $(TARGET).elf
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden