# Makefile -- Boot program makefile
# Copyright 2000 Free Software Foundation, Inc.
# Written by Stephane Carrez (stcarrez@worldnet.fr)
# 
# This file is part of GTAM.
# 
# GTAM 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, or (at your option)
# any later version.
# 
# GTAM 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 GTAM; see the file COPYING.  If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.  */
#
SRCDIR=.

BASEDIR=$(SRCDIR)/..

include $(BASEDIR)/config/make.defs

CFLAGS=-mshort -Os $(CPPFLAGS) -fomit-frame-pointer -msoft-reg-count=0 -Wall

LDFLAGS=-nostdlib -nostartfiles -Wl,-m,m68hc11elfb \
	-Wl,-defsym,_io_ports=0x1000 \
	-Wl,-defsym,_.tmp=0x0 -Wl,-defsym,_.z=0x2

LIBS=

CSRCS=booter.c

BOOT_SRCS=booter.c
CHECK_SRCS=checker.c
DUMP_SRCS=dumper.c
BLINK_SRCS=blink.c

BOOT_OBJS=$(BOOT_SRCS:.c=.o)
CHECK_OBJS=$(CHECK_SRCS:.c=.o)
DUMP_OBJS=$(DUMP_SRCS:.c=.o)
BLINK_OBJS=$(BLINK_SRCS:.c=.o)

BOOT_PROGS=booter.elf checker.elf dumper.elf blink.elf
BOOT_S19=$(BOOT_PROGS:.elf=.s19)
BOOT_BIN=$(BOOT_PROGS:.elf=.b)

all::	$(BOOT_PROGS) $(BOOT_S19) $(BOOT_BIN)

booter.elf:	$(BOOT_OBJS)
	$(CC) $(LDFLAGS) -o $@ $< $(LIBS)

checker.elf:	$(CHECK_OBJS)
	$(CC) $(LDFLAGS) -o $@ $< $(LIBS)

dumper.elf:	$(DUMP_OBJS)
	$(CC) $(LDFLAGS) -o $@ $< $(LIBS)

blink.elf:	$(BLINK_OBJS)
	$(CC) $(LDFLAGS) -o $@ $< $(LIBS)

checker.o: checker.c
	$(CC) $(CFLAGS) -c -o $@ checker.c

dumper.o: dumper.c
	$(CC) $(CFLAGS) -DNO_BREAK -c -o $@ dumper.c

