#-----------------------------------------------------------------------------#
# Defines:                                                                    #
#                                                                             #
# SCREEN	Which style of IO to use for the display. Choices are:        #
#		simple - simple no nonsense output                            #
#               curses - the curses package (requires curses/termcap libs     #
#		X11 - graphical interface, currently unwritten                #
#                                                                             #
# LIBS		Libraries need specific to the SCREEN definition              #
#                                                                             #
# ASSUME	Assume certain low level things, such as instruction fetches  #
#		are never from memory mapped IO etc. Hence not 100% accurate, #
#		but correct for nearly all code and MUCH faster.              #
#                                                                             #
# SUPERFAST	Always use fastest IO - ie no allowance for any mmap IO       #
#                                                                             #
# DEBUG		Add -d option to enable debugging. This slows things down by  #
#		(currently) around 10%.                                       #
#-----------------------------------------------------------------------------#

DEFINES = -DASSUME -DDEBUG

#simple:
SCREEN = simple
LIBS   =

#curses:
#SCREEN = curses
#LIBS   = -lcurses -ltermcap

#X11:
#SCREEN = X11
#LIBS   = -lX11

#-----------------------------------------------------------------------------#
# Compiler/linker defs.                                                       #
#-----------------------------------------------------------------------------#
CC	= gcc

DEBUG	= -O2 -fforce-mem -fforce-addr -fcaller-saves -ffast-math -fomit-frame-pointer -ffloat-store
#DEBUG	= -g

CFLAGS	= $(DEBUG) -DSCREEN_$(SCREEN) $(DEFINES)

LD	= $(CC)
LDFLAGS	= $(DEBUG)

#-----------------------------------------------------------------------------#
# You shouldn't need to change anything below here.                           #
#-----------------------------------------------------------------------------#
OBJS	= manager.o 6502.o opcodes.o 6522.o memory.o dis6502.o unix_io.o \
	  $(SCREEN)/screen.a

beeb:	$(OBJS) $(LIBS)
	$(LD) $(LDFLAGS) $(OBJS) -o beeb $(LIBS)

.c.o:
	$(CC) $(CFLAGS) -c $<

$(SCREEN)/screen.a: FORCE
	cd $(SCREEN); \
	$(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS)" "LD=$(LD)" "LD=$(LDFLAGS)"
FORCE:

# DO NOT DELETE THIS LINE -- make depend depends on it.
