#
# $Id: Makefile,v 1.8 2004/02/25 15:19:05 j Exp $
#
CC= avr-gcc
#MCU=at90s2313
MCU=at90s2333
#MCU=at90s4414
#MCU=at90s4433
#MCU=at90s4434
#MCU=at90s8515
#MCU=at90s8535
#MCU=atmega163

CFLAGS= -O2 -Wall -ffreestanding -mmcu=$(MCU)

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

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

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

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

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

.out.srec:
	avr-objcopy -O srec $< $@

all:	demo.bin demo.hex demo.s

demo-avr.pdf: demo-avr.ps
	sed -e 's/^1.00* cmscale/0.8 cmscale/' demo-avr.ps |\
	ps2pdf -dDEVICEWIDTHPOINTS=842 -dDEVICEHEIGHTPOINTS=595 \
	- demo-avr.pdf

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