#Copyright 1998, Matt Porter <mmporter@home.com>
#This software is covered under the terms of the GNU Public License.
#See the file, COPYING, for details.

#
# Makefile for mkbugboot
#

include config

CC=$(CROSS_COMPILE)gcc
HOSTCC=gcc
CFLAGS=-c
OBJCOPY=$(CROSS_COMPILE)objcopy

all: bugboot.bin

bugboot.bin: mkbugboot romboot.bin kernel_image res_data
	./mkbugboot romboot.bin kernel_image res_data bugboot.bin
 
romboot.bin: romboot.o
	$(OBJCOPY) --output-target=binary romboot.o romboot.bin

romboot.o: romboot.S
	$(CC) $(CFLAGS) \
	-DKERNEL_IMAGE=`wc -c <kernel_image | sed "s: ::g"` \
	-DRESDATA_DEST=$(RESDATA_DEST) \
	-DRESDATA_SIZE=$(RESDATA_SIZE) \
	-o romboot.o romboot.S

mkbugboot: mkbugboot.c
	$(HOSTCC) -o mkbugboot mkbugboot.c

distclean: clean
	rm -f kernel_image res_data

clean:
	rm -f bugboot.bin mkbugboot mkbugboot.o romboot.bin romboot.o 
