#	MC68010 Tiny Monitor -- Makefile
#	Copyright (C) 1988 Philip L. Budne
#
#	May be freely distributed and used for non-profit use only,
#	provided this, and all other Copyright notices remain intact.
#
#	Commercial use is strictly forbidden without explicit, written
#	permission of the author.

ASFLAGS=-mc68010
CFL=-R
CFLAGS=-O -mc68010 -fsoft $(CFL)
# attempted to use gcc, but failed
#CFLAGS=-O -m68000 -msoft-float $(CFL)
#CC=gcc
#GCCLIB=/usr/local/lib/gcc-gnulib

PRINTF=nprintf.o doprnt.o strlen.o
LIB=$(PRINTF) $(GCCLIB)

MON=newmon.o dump.o bcopy.o jmp.o itest.o vtest.o $(LIB)
NEW=new.o io.o $(MON)

all:	new a.out
	hexify new

version.o: $(NEW)
	./make-version > version.s
	$(AS) -o version.o version.s

# ROMable version
new:	$(NEW) version.o
	$(LD) -N -o new -Ttext 0 -Tdata 20fc00 $(NEW) version.o lib/lib.a

# runs in RAM (may crush itself in memory test!)
a.out:	$(NEW) version.o
	$(LD) -N -Ttext 200000 $(NEW) version.o -lc

# unix test version
TEST=test.o $(MON)
test:	$(TEST)
	$(CC) $(CFLAGS) -o test $(TEST) version.o

dump.o io.o newmon.o nprintf.o: sa_io.h

clean:
	rm -f *.o a.out new test core *~ \#* version.s
