###############################################################################
## C++ Compiler to use
###############################################################################
CPP = g++

###############################################################################
##
## General options used during compiling:
##
##   -DDEFINE_BOOL_TYPE if your C++ compiler doesn't support the bool type
##
##   -DEXCEPTION_FIX if your C++ compiler doesn't fully support exceptions
##       (This should be used with g++ 2.7.2 since its exception support 
##        doesn't allow optimizing)
##
##   -DTHROTTLE if you don't want the frame rate to exceed 60 FPS
##  
##   -DSHOW_TIMING if your want some timing information displayed when
##       you exit the program
##
##   -DDEBUG if you want a 6507 trace written to "M6507.debug" (Slow!)
##
##   -DDEBUG_ACCESSES if you want bad memory accesses displayed
##
###############################################################################
GENERAL_OPTIONS = -DTHROTTLE -DEXCEPTION_FIX 
#GENERAL_OPTIONS = -DTHROTTLE
#GENERAL_OPTIONS = -DTHROTTLE -DSHOW_TIMING
#GENERAL_OPTIONS = -DTHROTTLE -DSHOW_TIMING -fhandle-exceptions
#GENERAL_OPTIONS = -DTHROTTLE -DDEBUG_ACCESSES

###############################################################################
## Operating specific options
##
##   -DUNIX_OS if you're compiling on a unix machine
##
##   -DMSDOS_OS if you're compiling on an msdos machine
##
##   -DLINUX_JOYSTICK to include linux joystick driver support
##       (requires you to install the joystick kernel module)
##
###############################################################################
OS_OPTIONS = -DUNIX_OS
#OS_OPTIONS = -DUNIX_OS -DLINUX_JOYSTICK
#OS_OPTIONS = -DMSDOS_OS

###############################################################################
##
## If you're not using g++ you may need to remove -ansi and -Wall
##
###############################################################################
CPPFLAGS = -O -ansi -Wall $(OS_OPTIONS) $(GENERAL_OPTIONS)
#CPPFLAGS = -fhandle-exceptions -ansi -Wall $(OS_OPTIONS) $(GENERAL_OPTIONS)
#CPPFLAGS = -pg -fno-inline $(OS_OPTIONS) $(GENERAL_OPTIONS)

###############################################################################
## List of object files
###############################################################################
OBJS = Cart.o Cart2K.o Cart4K.o CartE0.o \
       CartF6.o CartF6SC.o CartF8.o CartFE.o \
       Console.o Control.o Joystick.o Paddle.o \
       M6507.o M6532.o Props.o System.o TIA.o \
       main.o

xstella: $(OBJS) TermX11.o
	$(CPP) -o xstella $(OBJS) TermX11.o -L/usr/X11R6/lib -lX11 -lXext

stella: $(OBJS) TermSVGA.o
	$(CPP) -o stella $(OBJS) TermSVGA.o -lvga

clean:
	rm -f *.o stella xstella 

.SUFFIXES: .cxx

.cxx.o:
	$(CPP) -c $(CPPFLAGS) $*.cxx

