# Name of target machine
target	= mega340

# Size of flash memory (29F010: 010, 29F040: 040)
size	= 010

CFLAGS	= -I .. -O -Wall -target ${target}
CC      = ecoc
LFLAGS  = -s -T ../${target}/flash${size}.ld ${CFLAGS}
B	= ../bin

all: list
list: list.o flash.o
	${CC} ${LFLAGS} -o $@ $^
	mkrom $@ $@.rom
	cp $@.rom ${target}.rom
list.o: list.c ../flash.h
	${CC} ${CFLAGS} -c $<
flash.o: ../flash.c ../flash.h
	${CC} ${CFLAGS} -c $<
ll: all
	flashing -i ${target}.rom
clean:
	rm -f list list.rom *.o core core.* a.out freak340.rom
veryclean: clean
	rm -f *.rom
install:
	@echo "Did you remember to make linker scripts for any target you want to use?"
	$(MAKE) clean
	$(MAKE) target=scotty08 all
	$(MAKE) clean
	$(MAKE) target=mega301 all
	$(MAKE) clean
	$(MAKE) target=mega332 all
	$(MAKE) clean
	$(MAKE) target=mega340 all
	$(MAKE) clean
	$(MAKE) target=freak340 all

