##
## Makefile for mc68000 emulation library
##
##   I. Curtis   9-Apr-97 11:25 -- added flags for SunOs4.1.4
##   I. Curtis  26-Feb-97 13:22 -- now produces libmc68k.a
##   I. Curtis  25-Feb-97 22:00 -- created
##

CC	= gcc -Wall

##
## set the following CFLAGS for linux
CFLAGS	= -pipe -O5

## set the following CFLAGS if you use SunOS 4.1.1
#CFLAGS	= -pipe -O3 -D__BIG_ENDIAN__ -DNEED_FTRUNCATE

all : libmc68k.a

CPUOBJS = cpu0.o cpu1.o cpu2.o cpu3.o cpu4.o cpu5.o cpu6.o cpu7.o \
	cpu8.o cpu9.o cpuA.o cpuB.o cpuC.o cpuD.o cpuE.o cpuF.o \
	cputbl.o

SYSOBJS = newcpu.o memory.o custom.o

##
## Make a library with all of the 68000 emulation stuff
## included
##
libmc68k.a : ${CPUOBJS} ${SYSOBJS}
	ar r libmc68k.a ${CPUOBJS} ${SYSOBJS}
	ranlib libmc68k.a

##
## maintain the cpu opcode emulators
##
cpu%.o : cpu%.c sysdeps.h shared.h newcpu.h cputbl.h custom.h memory.h 
	${CC} ${CFLAGS} -c cpu$*.c

##
## maintain pilot/dragonball emulation stuff
##
memory.o : memory.c sysdeps.h memory.h
	${CC} ${CFLAGS} -c memory.c

custom.o : custom.c custom.h shared.h sysdeps.h memory.h newcpu.h
	${CC} ${CFLAGS} -c custom.c

newcpu.o : newcpu.c newcpu.h shared.h sysdeps.h memory.h custom.h
	${CC} ${CFLAGS} -c newcpu.c

##
## keep it clean!
##
clean :
	/bin/rm -f ${CPUOBJS} ${SYSOBJS}

clobber : clean
	/bin/rm -f libmc68k.a
