#########################################################################
#                                                                       #
# makefile for xmame/xmess                                              #
#                                                                       #
# original by Juan Antonio Martinez                                     #
# current version by Hans de Goede                                      #
# http://x.mame.net                                                     #
# mailto:hans@highrise.nl                                               #
#                                                                       #
#									#
# READ COMMENTS AND MODIFY CONFIGURABLE OPTIONS WITH CARE...		#
#									#
# Members of Mame and X-Mame project assumes no responsability  	#
# implicit or explicit about illegal or incorrect use of this   	#
# sofware and about possible hard/soft damage derived of it   	  	#
#									#
# THIS SOFTWARE IS DISTRIBUTED "AS IS" . USE AT YOUR OWN RISK		#
#									#
# Mame and X-Mame are Copyright of Nicola Salmoria and Mirko buffoni	#
# and distributed under terms simular to the GNU General Public License #
# see doc/readme.unix for more details                                  #
#									#
# Arcade ROM images are copyright of their authors. DISTRIBUTING MAME   #
# OR X-MAME INCLUDING ROM IMAGES IN THE SAME PACKAGE IS ILLEGAL AND	#
# CONSTITUTES A VIOLATION OF TERMS OF COPYRIGHT				#
#									#
#########################################################################

##############################################################################
# xmame or xmess ?
##############################################################################

#set TAGET to "mame" (without the ") to compile xmame and to "mess" to
#compile xmess.
TARGET = mame


##############################################################################
# *** development environment options 
##############################################################################

# GNU MAKE is MANDATORY !!!

# *** Choose your compiler
# Use gcc if available
CC	= gcc
# otherwise try the default cc
# CC    = cc
# Use of `c89' is recommend for ultrix as it generates faster code (which
# means less frames to be skipped and better graphics) but `gcc' works just
# as well. However, stay away from the `cc' ultrix compiler if possible.
# CC	= c89

# *** Choose your compiler flags.
# Note1:
# xmame compilation breaks when using egcs-1.1.x or gcc-2.95, use
# -fno-strict-aliasing to fix it. gcc-2.95.1 does work with -fstrict-aliasing,
# and gives a nice speed increase.
#
# Note2:
# linux-powerpc needs -fsigned-char
#
# Note3:
# next/macosx needs -traditional-cpp
#
### for normal optimalisation, full warnings
# CFLAGS    = -O -Wall
### this should work with all compilers 
# CFLAGS    =
### to get full optimization under gcc/x Intel based OS's..
# CFLAGS    = -O3 -m486 -Wall -Wno-unused -funroll-loops \
#  -fstrength-reduce -fomit-frame-pointer -ffast-math -malign-functions=2 \
#  -malign-jumps=2 -malign-loops=2
### for Linux/PowerPC use following opts
# CFLAGS    = -O3 -Wall  -Wno-unused -funroll-loops\
#  -fstrength-reduce -fomit-frame-pointer -ffast-math -fsigned-char
### for OpenStep/MacOS X use following opts
# CFLAGS    = -O4 -Wall -Wno-unused -finline-functions -ffast-math \
#  -fstrength-reduce -traditional-cpp
### for IRIX with all optimization
# CFLAGS    = -O2 -OPT:Olimit=3077
### used by me, for full ansi testing and debugging (with gcc).
CFLAGS    = -ggdb -ansi -pedantic -D_XOPEN_SOURCE -D_BSD_SOURCE -Wall \
 -Wno-long-long -Wno-trigraphs -Wno-unused -Dasm=__asm__ -O3 -m486 \
 -fstrength-reduce -ffast-math -malign-functions=2 -malign-jumps=2 \
 -malign-loops=2

# *** Does your compiler supports inline funcs?. use appropiate item:
# do not use IL = inline : wont work due to Z80 and 6809 stuffs
# if strict ansi used set IL to "static"
# This can very noticably increase xmame's performance, so enabling this is
# encouraged, it works fine with gcc and probably with most other compilers.
IL	= '-DINLINE=static __inline__'
# IL     = -DINLINE=static

# *** Choose your linker & linker flags ( some OS's needs native linker
# instead GNU one )
# normal
# LD	= $(CC) -s
# to profile with gcc and gprof
# LD	= $(CC) -pg
# no profiling (less strace output), but with debug info
# LD	= $(CC)
# for debugging only, only works with gnu-binutils !!
LD	= $(CC) -Wl,-warn-common

# *** Does your platform have ranlib (leave this untouched unless you are
# using irix or Unixware 7
RANLIB = ranlib
# RANLIB = true

# *** How to install executable? ( some OS's doesn't support install command )
INSTALL = cp

# *** Extra include and or library paths, sometimes needed for zlib,
# with suse linux -L/usr/X11R6/lib is needed for example,
# and with unixware7 -lsocket is needed
# LIBS     = -L/usr/X11R6/lib -L/usr/local/lib
# INCLUDES = -I/usr/X11R6/include -I/usr/local/include

# *** If your system doesn't have zlib, or your systems zlib is giving you
# troubles, you can use the one distributed with xmame.
# Uncomment the following line to use xmame's own version of zlib
# ZLIB = 1

# *** Does your system support gettimeofday() function? If so, we encourage
# you to enable this feature . Else .... comment it :-(
HAVE_GETTIMEOFDAY = 1

# *** Uncomment this if you want to link with ElectricFence developers only !
# EFENCE = 1


##############################################################################
# *** Configuration files and directories
##############################################################################

# *** Select destination directory for your compiled program , manual page
# and binary distribution ( if you want to... )
# ( only needed to install, not to compile... )
DESTDIR = /usr/games
MANDIR  = /usr/local/man/man6

# *** xmameroot, this is the default rompath, place where the highscores are
# stored, global rc location etc. Since most of these are configurable through
# the rc-file anyway, there are no longer seperate defines for each.
XMAMEROOT = /usr/games/lib/x$(TARGET)


##############################################################################
# *** architecture, Choose your CPU (!!only one!!) 
##############################################################################

### i386 + gnu-asm
MY_CPU = i386
### i386 no asm
# MY_CPU = i386_noasm
### alpha
# MY_CPU = alpha
### m68k
# MY_CPU = m68k
### generic risc (powerpc, sparc, hppa, ibm)
# MY_CPU = risc
### generic risc, lsb-first (RISC (ultrix machines))
# MY_CPU = risc_lsb
### mips (generic risc + SGI compiler bug workarounds)
# MY_CPU = mips

##############################################################################
# *** architecture, Choose your OS (!!only one!!) 
##############################################################################

### Linux 
ARCH  = linux
### FreeBSD
# ARCH  = freebsd
### NetBSD
# ARCH  = netbsd
### Solaris / SunOS
# ARCH  = solaris
### OpenStep
# ARCH  = next
### Mac OS X
# ARCH  = macosx
### IRIX ( with sound requires the dmedia package ) (*)
# ARCH  = irix
### IRIX ( with sound using the new al package) (*)
# ARCH  = irix_al
### aix ( with sound, you'll need the UMS and SOM lpp's installed ( under AIX4 ))
# ARCH  = aix
### generic unix, no sound
# ARCH  = generic

# *) For IRIX 6.5 or higher add -DHAVE_SNPRINTF to CFLAGS.irix(_al) in
# src/unix/Makefile


##############################################################################
# *** Input Devices
##############################################################################

# *** uncomments any joystick types which you want to use, which one is
# actually used can be selected runtime with the -joytype switch.
# X Input Extensions based joystick, this is known to not work right now ;|
# JOY_X11 = 1
# on iX86 based OS's, if supported, you can use standard joystick driver
JOY_I386 = 1
# Linux FM-TOWNS game PAD joystick emulation support, thanks to Osamu Kurati
# JOY_PAD = 1


##############################################################################
# *** Sound Devices
##############################################################################

# *** any additonal sound drivers you want to include, besided the native one
# sound driver for your system
SOUND_ESOUND = 1


##############################################################################
# *** Select your display method, choose only one
# note: x11 is the only one supported on all platforms
##############################################################################

### X11
DISPLAY_METHOD = x11
### svgalib, only supported under linux
# DISPLAY_METHOD = svgalib
### ggi, only tested under linux
# DISPLAY_METHOD = ggi
### OpenGL under X11
# DISPLAY_METHOD = xgl
### glide under X11
# DISPLAY_METHOD = xfx
### glide in console mode
# DISPLAY_METHOD = svgafx
### OpenStep bitmaps
# DISPLAY_METHOD = openstep
### SDL library
# DISPLAY_METHOD = SDL


##############################################################################
# *** X windows options, only needed for X as display method
##############################################################################

# *** uncomment any extensions you wish to use.
# MIT-Shared Memory X Extensions, comment the
X11_MITSHM = 1
# XFree86 DGA
X11_DGA = 1
# The XIL library (Solaris 2.5.1 and higher), uncomment
# X11_XIL = 1

# *** Choice the location of your X headers & libs
# standard location for X11 
# X11INC		= -I/usr/include/X11
# X11LIB		= -L/usr/lib/X11
# standard location for XFree86
X11INC		= -I/usr/X11R6/include
X11LIB		= -L/usr/X11R6/lib
# for Sun systems
# X11INC		= -I/usr/openwin/include
# X11LIB		= -L/usr/openwin/lib
# for non-standard locations
# X11INC		= -I/usr/local/include/X11
# X11LIB		= -L/usr/local/lib

# *** The default name for the input device used by the X11 joystick driver.
# use provided program "xlistdev" to list available ones
X11_JOYNAME = "Joystick"


##############################################################################
# *** OpenGL info -- configure if you are using the xgl display option
##############################################################################
# *** what are the names of your OpenGL libs?
GLLIBS= -lGL -lGLU

# *** Uncomment next line if you're using NVIDIA's hw accelerated GLX drivers
# NVIDIA= -DNVIDIA


##############################################################################
# *** Special features
##############################################################################

# *** Uncommenty the next lines to build xmame with build in debugger, only
# supported for x11 and svgalib. Only enable this if you need it, if you
# want to develop drivers that is, since it slows down xmame concederably.
# MAME_DEBUG = 1

# *** Uncomment the next lines to use x86-asm cpu cores. This is only
# supported for some 386 machines with nasm-0.96 or higher available in your
# path! the asm 68k core could cause problem with certain games, please test
# with the c-core before reporting any problems.
# uncomment next line to use Assembler 68k engine
X86_ASM_68K = 1
#
# And choose elf / or aout
# ELF settings: no leading underscores + elf object format Tested with
# linux/i386. Also for e.g. Solaris/x86
ASM_STRIP = contrib/porting/strip_
NASM_FMT  = -f elf
# aout settings: with leading underscores + aout object format. Tested with
# netBSD i386. Also for older linux installs, freebsd and others.
# ASM_STRIP = true  # no strip command
# NASM_FMT  = -f aoutb


##############################################################################
# All done, type make -f makefile.unix and enjoy xmame/xmess ;)
# No configurable options below this line....
##############################################################################
include src/unix/unix.mak
