# Copyright (C) 2005 Thor Andreassen <ta@imada.sdu.dk> 
#                    Anders Dubgaard <anders@dubgaard.net>
#
# 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

BASETARGET = base
TERMINALTARGET = terminal

.PHONY: all clean erase load base terminal

include Makefile.common

all: base terminal

base:
	make -f Makefile.$(BASETARGET) TARGET=$(BASETARGET)
	
terminal:
	make -f Makefile.$(TERMINALTARGET) TARGET=$(TERMINALTARGET)

loadbase:
	make -f Makefile.$(BASETARGET) load TARGET=$(BASETARGET)

loadterminal:
	make -f Makefile.$(TERMINALTARGET) load TARGET=$(TERMINALTARGET)

erasebase:
	make -f Makefile.$(BASETARGET) load

eraseterminal:
	make -f Makefile.$(TERMINALTARGET) load

clean:
	make -f Makefile.$(BASETARGET) clean TARGET=$(BASETARGET)
	make -f Makefile.$(TERMINALTARGET) clean TARGET=$(TERMINALTARGET)

read_fuses:
	uisp --rd_fuses -dprog=$(INTERFACE)
	
fuse_defaults:
	uisp --wr_fuse_l=0xe1 -dprog=$(INTERFACE)

fuse_ext_crystal:
	uisp --wr_fuse_l=0xef -dprog=$(INTERFACE)

