
# a.lp_mp3 - Open Source Atmel AVR based MP3 Player
# Copyright (c) 2003-2005 K. John '2B|!2B' Crispin
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
#
# Feedback, Bugs.... mail john{AT}phrozen.org

 
 
 
TARGET = alp_mp3
CC = avr-gcc
MCU=atmega32
CFLAGS =  -O2 -g -Wall -ffreestanding -mmcu=$(MCU)
OBJS = usart.o vs1001.o delay.o mmc.o fat.o spi.o rotary.o pgm.o config.o rc5.o timer.o player.o buttons.o playlist.o logo.o comm_serial.o led.o settings.o random.o lcd_nok.o lcd_nok_scroll.o $(TARGET).o
OUTSIZE = @avr-size $(TARGET).out
MEMSIZE = @avr-size -A $(TARGET).out
MEMFAT	= @avr-size -A fat.o
MEMMMC	= @avr-size -A mmc.o
FINISH  = @echo Errors: none
BEGIN = @echo -------- Size --------
MEM   = @echo -------- Mem  --------
FAT   = @echo -------- Fat  --------
MMC   = @echo -------- MMC  --------
END   = @echo ----------------------

.SUFFIXES: .s .bin .out .hex .srec

.c.s:
	$(CC) $(CFLAGS) -S $<

.S.o:
	$(CC) $(ASFLAGS) -c $<

.o.out:
	$(CC) $(CFLAGS) -o $@ $<

.out.bin:
	avr-objcopy -O binary $< $@

.out.hex:
	avr-objcopy -O ihex $< $@

.out.srec:
	avr-objcopy -O srec $< $@
	
all:	 $(TARGET).hex  $(TARGET).elf size
#begin size middle memsize fat memfat mmc memmmc finished end 


# Eye candy.
begin:
	$(BEGIN)
	
finished:
	$(FINISH)

end:
	$(END)
	
middle:
	$(MEM)

fat:
	$(FAT)

mmc:
	$(MMC)

size:
	$(OUTSIZE)

memsize:
	$(MEMSIZE)
memmmc:
	$(MEMMMC)
memfat:
	$(MEMFAT)

alp_mp3.out: $(OBJS)
	$(CC) -o $(TARGET).out $(CFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS)

clean:
	rm -f *~ *.out *.bin *.hex *.srec *.S *.o *.s 
