# Processortyp M fuer Compiler, N fuer avrdude:
M=atmega32
N=m32
# Compileraufrufe:
C=avr-gcc -mmcu=$M -Wall -Os -c
A=avr-as
L=avr-gcc -mmcu=$M -Wall -Os

# fuer avrdude-Aufruf unter Linux:
TTY=/dev/ttyUSB0
# fuer avrdude-Aufruf unter MacOSX:
#TTY=/dev/tty.serial-0001

all: tarech.hex

tarech.hex: tarech.cc lcd4zeilen.cc fliesszahlklasse.cc int48.cc
	$L tarech.cc -o tarech.elf
	avr-objcopy -O ihex -R .eeprom tarech.elf tarech.hex
	avr-objdump -h -S tarech.elf > tarech.lss

check:
	avrdude -p $N -c avr910 -P $(TTY) -v
check2:
	avrdude -p $N -F -c avr910 -P $(TTY) -v

# Fuses fuer 16MHz Quarz, fuer ATmega8 oder ATmega32:
fusesetzen:
	avrdude -p m32 -c avr910 -P $(TTY) -U lfuse:w:0xFF:m
	avrdude -p m32 -c avr910 -P $(TTY) -U hfuse:w:0xC9:m

install: tarech.hex
	avrdude -p $N -c avr910 -P $(TTY) -U flash:w:tarech.hex:i

clean:
	rm -f *~ *.o *.elf
clean_all:
	rm -f *~ *.o *.elf *.lss *.hex
