2007-12-17 16:19:59 +01:00
|
|
|
###########################################################################
|
|
|
|
#
|
|
|
|
# makefile
|
|
|
|
#
|
|
|
|
# Core makefile for building MAME and derivatives
|
|
|
|
#
|
2008-01-06 01:47:40 +01:00
|
|
|
# Copyright (c) Nicola Salmoria and the MAME Team.
|
2007-12-17 16:19:59 +01:00
|
|
|
# Visit http://mamedev.org for licensing and usage restrictions.
|
|
|
|
#
|
|
|
|
###########################################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###########################################################################
|
|
|
|
################# BEGIN USER-CONFIGURABLE OPTIONS #####################
|
|
|
|
###########################################################################
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# specify core target: mame, mess, etc.
|
|
|
|
# specify subtarget: mame, mess, tiny, etc.
|
|
|
|
# build rules will be included from
|
|
|
|
# src/$(TARGET)/$(SUBTARGET).mak
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
ifndef TARGET
|
|
|
|
TARGET = mame
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef SUBTARGET
|
|
|
|
SUBTARGET = $(TARGET)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# specify OSD layer: windows, sdl, etc.
|
|
|
|
# build rules will be included from
|
|
|
|
# src/osd/$(OSD)/$(OSD).mak
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
ifndef OSD
|
2010-01-13 17:27:27 +01:00
|
|
|
ifeq ($(OS),Windows_NT)
|
2007-12-17 16:19:59 +01:00
|
|
|
OSD = windows
|
2010-01-13 17:27:27 +01:00
|
|
|
TARGETOS = win32
|
|
|
|
else
|
|
|
|
OSD = sdl
|
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
endif
|
|
|
|
|
2008-02-22 01:17:36 +01:00
|
|
|
ifndef CROSS_BUILD_OSD
|
|
|
|
CROSS_BUILD_OSD = $(OSD)
|
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
2008-05-12 00:15:13 +02:00
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# specify OS target, which further differentiates
|
|
|
|
# the underlying OS; supported values are:
|
|
|
|
# win32, unix, macosx, os2
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
ifndef TARGETOS
|
2010-01-16 05:40:55 +01:00
|
|
|
|
2010-01-13 17:27:27 +01:00
|
|
|
ifeq ($(OS),Windows_NT)
|
2007-12-17 16:19:59 +01:00
|
|
|
TARGETOS = win32
|
|
|
|
else
|
2010-01-16 05:40:55 +01:00
|
|
|
|
2010-01-15 23:05:00 +01:00
|
|
|
ifneq ($(CROSSBUILD),1)
|
2010-01-19 22:53:06 +01:00
|
|
|
|
|
|
|
ifneq ($(OS2_SHELL),)
|
2010-02-03 21:00:10 +01:00
|
|
|
TARGETOS = os2
|
2010-01-19 22:53:06 +01:00
|
|
|
else
|
|
|
|
|
2010-01-15 22:05:29 +01:00
|
|
|
UNAME = $(shell uname -a)
|
|
|
|
|
2010-01-15 23:05:00 +01:00
|
|
|
ifeq ($(firstword $(filter Linux,$(UNAME))),Linux)
|
2011-10-31 02:30:24 +01:00
|
|
|
TARGETOS = linux
|
2007-12-17 16:19:59 +01:00
|
|
|
endif
|
2010-01-15 23:05:00 +01:00
|
|
|
ifeq ($(firstword $(filter Solaris,$(UNAME))),Solaris)
|
2010-01-15 22:05:29 +01:00
|
|
|
TARGETOS = solaris
|
|
|
|
endif
|
2010-01-15 23:05:00 +01:00
|
|
|
ifeq ($(firstword $(filter FreeBSD,$(UNAME))),FreeBSD)
|
2010-01-15 22:05:29 +01:00
|
|
|
TARGETOS = freebsd
|
|
|
|
endif
|
2010-03-24 05:06:07 +01:00
|
|
|
ifeq ($(firstword $(filter GNU/kFreeBSD,$(UNAME))),GNU/kFreeBSD)
|
|
|
|
TARGETOS = freebsd
|
|
|
|
endif
|
2011-02-02 04:29:54 +01:00
|
|
|
ifeq ($(firstword $(filter NetBSD,$(UNAME))),NetBSD)
|
|
|
|
TARGETOS = netbsd
|
|
|
|
endif
|
2010-01-20 02:32:08 +01:00
|
|
|
ifeq ($(firstword $(filter OpenBSD,$(UNAME))),OpenBSD)
|
2010-01-20 02:18:35 +01:00
|
|
|
TARGETOS = openbsd
|
|
|
|
endif
|
2010-01-15 23:05:00 +01:00
|
|
|
ifeq ($(firstword $(filter Darwin,$(UNAME))),Darwin)
|
2010-01-15 22:05:29 +01:00
|
|
|
TARGETOS = macosx
|
2007-12-17 16:19:59 +01:00
|
|
|
endif
|
|
|
|
|
2010-01-15 23:05:00 +01:00
|
|
|
ifndef TARGETOS
|
|
|
|
$(error Unable to detect TARGETOS from uname -a: $(UNAME))
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Autodetect PTR64
|
|
|
|
ifndef PTR64
|
|
|
|
ifeq ($(firstword $(filter x86_64,$(UNAME))),x86_64)
|
|
|
|
PTR64 = 1
|
2010-01-15 22:05:29 +01:00
|
|
|
endif
|
2010-01-20 02:18:35 +01:00
|
|
|
ifeq ($(firstword $(filter amd64,$(UNAME))),amd64)
|
|
|
|
PTR64 = 1
|
|
|
|
endif
|
2010-04-14 15:51:37 +02:00
|
|
|
ifeq ($(firstword $(filter ppc64,$(UNAME))),ppc64)
|
|
|
|
PTR64 = 1
|
|
|
|
endif
|
2010-01-15 22:05:29 +01:00
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2010-01-16 14:02:03 +01:00
|
|
|
# Autodetect BIGENDIAN
|
|
|
|
# MacOSX
|
|
|
|
ifndef BIGENDIAN
|
|
|
|
ifneq (,$(findstring Power,$(UNAME)))
|
|
|
|
BIGENDIAN=1
|
|
|
|
endif
|
|
|
|
# Linux
|
|
|
|
ifneq (,$(findstring ppc,$(UNAME)))
|
|
|
|
BIGENDIAN=1
|
|
|
|
endif
|
|
|
|
endif # BIGENDIAN
|
|
|
|
|
2010-01-19 22:53:06 +01:00
|
|
|
endif # OS/2
|
2010-01-16 14:02:03 +01:00
|
|
|
endif # CROSS_BUILD
|
2010-01-15 23:05:00 +01:00
|
|
|
endif # Windows_NT
|
2010-01-16 05:40:55 +01:00
|
|
|
|
2010-01-15 23:05:00 +01:00
|
|
|
endif # TARGET_OS
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2010-01-16 05:40:55 +01:00
|
|
|
|
|
|
|
ifeq ($(TARGETOS),win32)
|
|
|
|
|
|
|
|
# Autodetect PTR64
|
|
|
|
ifndef PTR64
|
|
|
|
ifneq (,$(findstring mingw64-w64,$(PATH)))
|
|
|
|
PTR64=1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-12-17 17:37:57 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# configure name of final executable
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# uncomment and specify prefix to be added to the name
|
|
|
|
# PREFIX =
|
|
|
|
|
|
|
|
# uncomment and specify suffix to be added to the name
|
|
|
|
# SUFFIX =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# specify architecture-specific optimizations
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# uncomment and specify architecture-specific optimizations here
|
|
|
|
# some examples:
|
2012-04-29 23:47:31 +02:00
|
|
|
# ARCHOPTS = -march=pentiumpro # optimize for I686
|
|
|
|
# ARCHOPTS = -march=core2 # optimize for Core 2
|
|
|
|
# ARCHOPTS = -march=native # optimize for local machine (auto detect)
|
|
|
|
# ARCHOPTS = -mcpu=G4 # optimize for G4
|
2007-12-17 17:37:57 +01:00
|
|
|
# note that we leave this commented by default so that you can
|
|
|
|
# configure this in your environment and never have to think about it
|
|
|
|
# ARCHOPTS =
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# specify program options; see each option below
|
|
|
|
# for details
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
2008-02-02 09:57:39 +01:00
|
|
|
# uncomment next line to build a debug version
|
2010-12-30 07:50:24 +01:00
|
|
|
# DEBUG = 1
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
# uncomment next line to include the internal profiler
|
|
|
|
# PROFILER = 1
|
|
|
|
|
2008-05-12 00:15:13 +02:00
|
|
|
# uncomment the force the universal DRC to always use the C backend
|
|
|
|
# you may need to do this if your target architecture does not have
|
|
|
|
# a native backend
|
|
|
|
# FORCE_DRC_C_BACKEND = 1
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2010-01-13 04:49:37 +01:00
|
|
|
# uncomment next line to build using unix-style libsdl on Mac OS X
|
|
|
|
# (vs. the native framework port). Normal users should not enable this.
|
|
|
|
# MACOSX_USE_LIBSDL = 1
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
2010-01-13 17:27:27 +01:00
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# specify build options; see each option below
|
|
|
|
# for details
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# uncomment next line if you are building for a 64-bit target
|
|
|
|
# PTR64 = 1
|
|
|
|
|
2007-12-17 17:37:57 +01:00
|
|
|
# uncomment next line if you are building for a big-endian target
|
|
|
|
# BIGENDIAN = 1
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
# uncomment next line to build expat as part of MAME build
|
|
|
|
BUILD_EXPAT = 1
|
|
|
|
|
|
|
|
# uncomment next line to build zlib as part of MAME build
|
|
|
|
BUILD_ZLIB = 1
|
|
|
|
|
2012-03-29 23:56:18 +02:00
|
|
|
# uncomment next line to build libflac as part of MAME build
|
|
|
|
BUILD_FLAC = 1
|
|
|
|
|
|
|
|
# uncomment next line to build jpeglib as part of MAME build
|
|
|
|
BUILD_JPEGLIB = 1
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
# uncomment next line to include the symbols
|
2011-11-09 22:40:29 +01:00
|
|
|
# SYMBOLS = 1
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2010-06-12 01:07:16 +02:00
|
|
|
# specify symbols level or leave commented to use the default
|
|
|
|
# (default is SYMLEVEL = 2 normally; use 1 if you only need backtrace)
|
|
|
|
# SYMLEVEL = 2
|
|
|
|
|
2010-07-02 05:49:56 +02:00
|
|
|
# uncomment next line to dump the symbols to a .sym file
|
|
|
|
# DUMPSYM = 1
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
# uncomment next line to include profiling information from the compiler
|
|
|
|
# PROFILE = 1
|
|
|
|
|
|
|
|
# uncomment next line to generate a link map for exception handling in windows
|
2009-07-30 00:52:54 +02:00
|
|
|
# MAP = 1
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2008-04-02 10:28:58 +02:00
|
|
|
# uncomment next line to generate verbose build information
|
|
|
|
# VERBOSE = 1
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
# specify optimization level or leave commented to use the default
|
|
|
|
# (default is OPTIMIZE = 3 normally, or OPTIMIZE = 0 with symbols)
|
|
|
|
# OPTIMIZE = 3
|
|
|
|
|
|
|
|
|
|
|
|
###########################################################################
|
|
|
|
################## END USER-CONFIGURABLE OPTIONS ######################
|
|
|
|
###########################################################################
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# sanity check the configuration
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# specify a default optimization level if none explicitly stated
|
|
|
|
ifndef OPTIMIZE
|
|
|
|
ifndef SYMBOLS
|
|
|
|
OPTIMIZE = 3
|
|
|
|
else
|
|
|
|
OPTIMIZE = 0
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# profiler defaults to on for DEBUG builds
|
|
|
|
ifdef DEBUG
|
|
|
|
ifndef PROFILER
|
|
|
|
PROFILER = 1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2010-04-08 08:10:18 +02:00
|
|
|
# allow gprof profiling as well, which overrides the internal PROFILER
|
2010-06-12 01:07:16 +02:00
|
|
|
# also enable symbols as it is useless without them
|
|
|
|
ifdef PROFILE
|
2010-04-08 08:10:18 +02:00
|
|
|
PROFILER =
|
2010-06-12 01:07:16 +02:00
|
|
|
SYMBOLS = 1
|
|
|
|
ifndef SYMLEVEL
|
|
|
|
SYMLEVEL = 1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# set the symbols level
|
|
|
|
ifdef SYMBOLS
|
|
|
|
ifndef SYMLEVEL
|
|
|
|
SYMLEVEL = 2
|
|
|
|
endif
|
2010-04-08 08:10:18 +02:00
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# platform-specific definitions
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# extension for executables
|
|
|
|
EXE =
|
|
|
|
|
|
|
|
ifeq ($(TARGETOS),win32)
|
|
|
|
EXE = .exe
|
|
|
|
endif
|
|
|
|
ifeq ($(TARGETOS),os2)
|
|
|
|
EXE = .exe
|
|
|
|
endif
|
|
|
|
|
2008-02-22 01:17:36 +01:00
|
|
|
ifndef BUILD_EXE
|
|
|
|
BUILD_EXE = $(EXE)
|
|
|
|
endif
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
# compiler, linker and utilities
|
|
|
|
AR = @ar
|
|
|
|
CC = @gcc
|
2010-01-03 22:31:44 +01:00
|
|
|
LD = @g++
|
2007-12-17 16:19:59 +01:00
|
|
|
MD = -mkdir$(EXE)
|
|
|
|
RM = @rm -f
|
2010-07-02 05:49:56 +02:00
|
|
|
OBJDUMP = @objdump
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# form the name of the executable
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
2010-01-13 17:27:27 +01:00
|
|
|
# reset all internal prefixes/suffixes
|
|
|
|
PREFIXSDL =
|
|
|
|
SUFFIX64 =
|
|
|
|
SUFFIXDEBUG =
|
2010-06-12 01:07:16 +02:00
|
|
|
SUFFIXPROFILE =
|
2010-01-13 17:27:27 +01:00
|
|
|
|
|
|
|
# Windows SDL builds get an SDL prefix
|
|
|
|
ifeq ($(OSD),sdl)
|
|
|
|
ifeq ($(TARGETOS),win32)
|
|
|
|
PREFIXSDL = sdl
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2010-01-03 22:31:44 +01:00
|
|
|
# 64-bit builds get a '64' suffix
|
2010-01-19 23:09:45 +01:00
|
|
|
ifeq ($(PTR64),1)
|
2010-01-03 22:31:44 +01:00
|
|
|
SUFFIX64 = 64
|
2007-12-17 16:19:59 +01:00
|
|
|
endif
|
|
|
|
|
2010-01-03 22:31:44 +01:00
|
|
|
# debug builds just get the 'd' suffix and nothing more
|
|
|
|
ifdef DEBUG
|
|
|
|
SUFFIXDEBUG = d
|
2009-02-28 23:10:06 +01:00
|
|
|
endif
|
|
|
|
|
2010-04-08 08:10:18 +02:00
|
|
|
# gprof builds get an addition 'p' suffix
|
2010-06-12 01:07:16 +02:00
|
|
|
ifdef PROFILE
|
|
|
|
SUFFIXPROFILE = p
|
2010-04-08 08:10:18 +02:00
|
|
|
endif
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
# the name is just 'target' if no subtarget; otherwise it is
|
|
|
|
# the concatenation of the two (e.g., mametiny)
|
|
|
|
ifeq ($(TARGET),$(SUBTARGET))
|
|
|
|
NAME = $(TARGET)
|
|
|
|
else
|
|
|
|
NAME = $(TARGET)$(SUBTARGET)
|
|
|
|
endif
|
|
|
|
|
2010-01-03 22:31:44 +01:00
|
|
|
# fullname is prefix+name+suffix+suffix64+suffixdebug
|
2010-06-12 01:07:16 +02:00
|
|
|
FULLNAME = $(PREFIX)$(PREFIXSDL)$(NAME)$(SUFFIX)$(SUFFIX64)$(SUFFIXDEBUG)$(SUFFIXPROFILE)
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
# add an EXE suffix to get the final emulator name
|
|
|
|
EMULATOR = $(FULLNAME)$(EXE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# source and object locations
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# all sources are under the src/ directory
|
|
|
|
SRC = src
|
|
|
|
|
|
|
|
# build the targets in different object dirs, so they can co-exist
|
2011-11-22 10:10:58 +01:00
|
|
|
OBJ = obj/$(PREFIX)$(OSD)$(SUFFIX)$(SUFFIX64)$(SUFFIXDEBUG)$(SUFFIXPROFILE)
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# compile-time definitions
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# CR/LF setup: use both on win32/os2, CR only on everything else
|
|
|
|
DEFS = -DCRLF=2
|
|
|
|
|
|
|
|
ifeq ($(TARGETOS),win32)
|
|
|
|
DEFS = -DCRLF=3
|
|
|
|
endif
|
|
|
|
ifeq ($(TARGETOS),os2)
|
|
|
|
DEFS = -DCRLF=3
|
|
|
|
endif
|
|
|
|
|
|
|
|
# map the INLINE to something digestible by GCC
|
2010-01-05 23:01:10 +01:00
|
|
|
DEFS += -DINLINE="static inline"
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
# define LSB_FIRST if we are a little-endian target
|
2007-12-17 17:37:57 +01:00
|
|
|
ifndef BIGENDIAN
|
2007-12-17 16:19:59 +01:00
|
|
|
DEFS += -DLSB_FIRST
|
|
|
|
endif
|
|
|
|
|
|
|
|
# define PTR64 if we are a 64-bit target
|
2010-01-19 23:09:45 +01:00
|
|
|
ifeq ($(PTR64),1)
|
2007-12-17 16:19:59 +01:00
|
|
|
DEFS += -DPTR64
|
|
|
|
endif
|
|
|
|
|
|
|
|
# define MAME_DEBUG if we are a debugging build
|
|
|
|
ifdef DEBUG
|
|
|
|
DEFS += -DMAME_DEBUG
|
|
|
|
else
|
|
|
|
DEFS += -DNDEBUG
|
|
|
|
endif
|
|
|
|
|
|
|
|
# define MAME_PROFILER if we are a profiling build
|
|
|
|
ifdef PROFILER
|
|
|
|
DEFS += -DMAME_PROFILER
|
|
|
|
endif
|
|
|
|
|
2011-10-31 02:30:24 +01:00
|
|
|
# define USE_NETWORK if we are a making network enabled build
|
|
|
|
ifdef USE_NETWORK
|
|
|
|
DEFS += -DUSE_NETWORK
|
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
|
Move devices into a proper hierarchy and handle naming
and paths consistently for devices, I/O ports, memory
regions, memory banks, and memory shares. [Aaron Giles]
NOTE: there are likely regressions lurking here, mostly
due to devices not being properly found. I have temporarily
added more logging to -verbose to help understand what's
going on. Please let me know ASAP if anything that is being
actively worked on got broken.
As before, the driver device is the root device and all
other devices are owned by it. Previously all devices
were kept in a single master list, and the hierarchy was
purely logical. With this change, each device owns its
own list of subdevices, and the hierarchy is explicitly
manifest. This means when a device is removed, all of its
subdevices are automatically removed as well.
A side effect of this is that walking the device list is
no longer simple. To address this, a new set of iterator
classes is provided, which walks the device tree in a depth
first manner. There is a general device_iterator class for
walking all devices, plus templates for a device_type_iterator
and a device_interface_iterator which are used to build
iterators for identifying only devices of a given type or
with a given interface. Typedefs for commonly-used cases
(e.g., screen_device_iterator, memory_interface_iterator)
are provided. Iterators can also provide counts, and can
perform indexed lookups.
All device name lookups are now done relative to another
device. The maching_config and running_machine classes now
have a root_device() method to get the root of the hierarchy.
The existing machine->device("name") is now equivalent to
machine->root_device().subdevice("name").
A proper and normalized device path structure is now
supported. Device names that start with a colon are
treated as absolute paths from the root device. Device
names can also use a caret (^) to refer to the owning
device. Querying the device's tag() returns the device's
full path from the root. A new method basetag() returns
just the final tag.
The new pathing system is built on top of the
device_t::subtag() method, so anyone using that will
automatically support the new pathing rules. Each device
has its own internal map to cache successful lookups so
that subsequent lookups should be very fast.
Updated every place I could find that referenced devices,
memory regions, I/O ports, memory banks and memory shares
to leverage subtag/subdevice (or siblingtag/siblingdevice
which are built on top).
Removed the device_list class, as it doesn't apply any
more. Moved some of its methods into running_machine
instead.
Simplified the device callback system since the new
pathing can describe all of the special-case devices that
were previously handled manually.
Changed the core output function callbacks to be delegates.
Completely rewrote the validity checking mechanism. The
validity checker is now a proper C++ class, and temporarily
takes over the error and warning outputs. All errors and
warnings are collected during a session, and then output in
a consistent manner, with an explicit driver and source file
listed for each one, as well as additional device and/or
I/O port contexts where appropriate. Validity checkers
should no longer explicitly output this information, just
the error, assuming that the context is provided.
Rewrote the software_list_device as a modern device, getting
rid of the software_list_config abstraction and simplifying
things.
Changed the way FLAC compiles so that it works like other
external libraries, and also compiles successfully for MSVC
builds.
2012-01-24 21:18:55 +01:00
|
|
|
# need to ensure FLAC functions are statically linked
|
2012-03-29 23:56:18 +02:00
|
|
|
ifeq ($(BUILD_FLAC),1)
|
Move devices into a proper hierarchy and handle naming
and paths consistently for devices, I/O ports, memory
regions, memory banks, and memory shares. [Aaron Giles]
NOTE: there are likely regressions lurking here, mostly
due to devices not being properly found. I have temporarily
added more logging to -verbose to help understand what's
going on. Please let me know ASAP if anything that is being
actively worked on got broken.
As before, the driver device is the root device and all
other devices are owned by it. Previously all devices
were kept in a single master list, and the hierarchy was
purely logical. With this change, each device owns its
own list of subdevices, and the hierarchy is explicitly
manifest. This means when a device is removed, all of its
subdevices are automatically removed as well.
A side effect of this is that walking the device list is
no longer simple. To address this, a new set of iterator
classes is provided, which walks the device tree in a depth
first manner. There is a general device_iterator class for
walking all devices, plus templates for a device_type_iterator
and a device_interface_iterator which are used to build
iterators for identifying only devices of a given type or
with a given interface. Typedefs for commonly-used cases
(e.g., screen_device_iterator, memory_interface_iterator)
are provided. Iterators can also provide counts, and can
perform indexed lookups.
All device name lookups are now done relative to another
device. The maching_config and running_machine classes now
have a root_device() method to get the root of the hierarchy.
The existing machine->device("name") is now equivalent to
machine->root_device().subdevice("name").
A proper and normalized device path structure is now
supported. Device names that start with a colon are
treated as absolute paths from the root device. Device
names can also use a caret (^) to refer to the owning
device. Querying the device's tag() returns the device's
full path from the root. A new method basetag() returns
just the final tag.
The new pathing system is built on top of the
device_t::subtag() method, so anyone using that will
automatically support the new pathing rules. Each device
has its own internal map to cache successful lookups so
that subsequent lookups should be very fast.
Updated every place I could find that referenced devices,
memory regions, I/O ports, memory banks and memory shares
to leverage subtag/subdevice (or siblingtag/siblingdevice
which are built on top).
Removed the device_list class, as it doesn't apply any
more. Moved some of its methods into running_machine
instead.
Simplified the device callback system since the new
pathing can describe all of the special-case devices that
were previously handled manually.
Changed the core output function callbacks to be delegates.
Completely rewrote the validity checking mechanism. The
validity checker is now a proper C++ class, and temporarily
takes over the error and warning outputs. All errors and
warnings are collected during a session, and then output in
a consistent manner, with an explicit driver and source file
listed for each one, as well as additional device and/or
I/O port contexts where appropriate. Validity checkers
should no longer explicitly output this information, just
the error, assuming that the context is provided.
Rewrote the software_list_device as a modern device, getting
rid of the software_list_config abstraction and simplifying
things.
Changed the way FLAC compiles so that it works like other
external libraries, and also compiles successfully for MSVC
builds.
2012-01-24 21:18:55 +01:00
|
|
|
DEFS += -DFLAC__NO_DLL
|
2012-03-29 23:56:18 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
# define USE_SYSTEM_JPEGLIB if library shipped with MAME is not used
|
|
|
|
ifneq ($(BUILD_JPEGLIB),1)
|
|
|
|
DEFS += -DUSE_SYSTEM_JPEGLIB
|
|
|
|
endif
|
Move devices into a proper hierarchy and handle naming
and paths consistently for devices, I/O ports, memory
regions, memory banks, and memory shares. [Aaron Giles]
NOTE: there are likely regressions lurking here, mostly
due to devices not being properly found. I have temporarily
added more logging to -verbose to help understand what's
going on. Please let me know ASAP if anything that is being
actively worked on got broken.
As before, the driver device is the root device and all
other devices are owned by it. Previously all devices
were kept in a single master list, and the hierarchy was
purely logical. With this change, each device owns its
own list of subdevices, and the hierarchy is explicitly
manifest. This means when a device is removed, all of its
subdevices are automatically removed as well.
A side effect of this is that walking the device list is
no longer simple. To address this, a new set of iterator
classes is provided, which walks the device tree in a depth
first manner. There is a general device_iterator class for
walking all devices, plus templates for a device_type_iterator
and a device_interface_iterator which are used to build
iterators for identifying only devices of a given type or
with a given interface. Typedefs for commonly-used cases
(e.g., screen_device_iterator, memory_interface_iterator)
are provided. Iterators can also provide counts, and can
perform indexed lookups.
All device name lookups are now done relative to another
device. The maching_config and running_machine classes now
have a root_device() method to get the root of the hierarchy.
The existing machine->device("name") is now equivalent to
machine->root_device().subdevice("name").
A proper and normalized device path structure is now
supported. Device names that start with a colon are
treated as absolute paths from the root device. Device
names can also use a caret (^) to refer to the owning
device. Querying the device's tag() returns the device's
full path from the root. A new method basetag() returns
just the final tag.
The new pathing system is built on top of the
device_t::subtag() method, so anyone using that will
automatically support the new pathing rules. Each device
has its own internal map to cache successful lookups so
that subsequent lookups should be very fast.
Updated every place I could find that referenced devices,
memory regions, I/O ports, memory banks and memory shares
to leverage subtag/subdevice (or siblingtag/siblingdevice
which are built on top).
Removed the device_list class, as it doesn't apply any
more. Moved some of its methods into running_machine
instead.
Simplified the device callback system since the new
pathing can describe all of the special-case devices that
were previously handled manually.
Changed the core output function callbacks to be delegates.
Completely rewrote the validity checking mechanism. The
validity checker is now a proper C++ class, and temporarily
takes over the error and warning outputs. All errors and
warnings are collected during a session, and then output in
a consistent manner, with an explicit driver and source file
listed for each one, as well as additional device and/or
I/O port contexts where appropriate. Validity checkers
should no longer explicitly output this information, just
the error, assuming that the context is provided.
Rewrote the software_list_device as a modern device, getting
rid of the software_list_config abstraction and simplifying
things.
Changed the way FLAC compiles so that it works like other
external libraries, and also compiles successfully for MSVC
builds.
2012-01-24 21:18:55 +01:00
|
|
|
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# compile flags
|
2009-02-28 23:10:06 +01:00
|
|
|
# CCOMFLAGS are common flags
|
|
|
|
# CONLYFLAGS are flags only used when compiling for C
|
|
|
|
# CPPONLYFLAGS are flags only used when compiling for C++
|
2010-01-15 23:05:00 +01:00
|
|
|
# COBJFLAGS are flags only used when compiling for Objective-C(++)
|
2007-12-17 16:19:59 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
|
2009-02-28 23:10:06 +01:00
|
|
|
# start with empties for everything
|
|
|
|
CCOMFLAGS =
|
|
|
|
CONLYFLAGS =
|
2010-01-15 23:05:00 +01:00
|
|
|
COBJFLAGS =
|
2009-02-28 23:10:06 +01:00
|
|
|
CPPONLYFLAGS =
|
|
|
|
|
|
|
|
# CFLAGS is defined based on C or C++ targets
|
|
|
|
# (remember, expansion only happens when used, so doing it here is ok)
|
|
|
|
CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
|
|
|
|
|
|
|
|
# we compile C-only to C89 standard with GNU extensions
|
|
|
|
# we compile C++ code to C++98 standard with GNU extensions
|
|
|
|
CONLYFLAGS += -std=gnu89
|
|
|
|
CPPONLYFLAGS += -x c++ -std=gnu++98
|
2010-01-15 23:05:00 +01:00
|
|
|
COBJFLAGS += -x objective-c++
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2007-12-17 17:37:57 +01:00
|
|
|
# this speeds it up a bit by piping between the preprocessor/compiler/assembler
|
2009-02-28 23:10:06 +01:00
|
|
|
CCOMFLAGS += -pipe
|
2007-12-17 17:37:57 +01:00
|
|
|
|
2009-02-28 23:10:06 +01:00
|
|
|
# add -g if we need symbols, and ensure we have frame pointers
|
2007-12-17 16:19:59 +01:00
|
|
|
ifdef SYMBOLS
|
2010-06-12 01:07:16 +02:00
|
|
|
CCOMFLAGS += -g$(SYMLEVEL) -fno-omit-frame-pointer
|
2007-12-17 16:19:59 +01:00
|
|
|
endif
|
|
|
|
|
2008-04-02 10:28:58 +02:00
|
|
|
# add -v if we need verbose build information
|
|
|
|
ifdef VERBOSE
|
2009-02-28 23:10:06 +01:00
|
|
|
CCOMFLAGS += -v
|
2008-04-02 10:28:58 +02:00
|
|
|
endif
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
# add profiling information for the compiler
|
|
|
|
ifdef PROFILE
|
2009-02-28 23:10:06 +01:00
|
|
|
CCOMFLAGS += -pg
|
2007-12-17 16:19:59 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
# add the optimization flag
|
2009-02-28 23:10:06 +01:00
|
|
|
CCOMFLAGS += -O$(OPTIMIZE)
|
2007-12-17 16:19:59 +01:00
|
|
|
|
ioport.c C++ conversion. Mostly internal changes, with no
intended differences from previous behavior. For drivers,
the main change is that input_port_read() no longer exists.
Instead, the port must be fetched from the appropriate device,
and then read() is called.
For member functions, this is actually simpler/cleaner:
value = ioport("tag")->read()
For legacy functions which have a driver_data state, it goes:
value = state->ioport("tag")->read()
For other legacy functions, they need to fetch the root device:
value = machine.root_device().ioport("tag")->read()
The other big change for drivers is that IPT_VBLANK is gone.
Instead, it has been replaced by a device line callback on the
screen device. There's a new macro PORT_VBLANK("tag") which
automatically points things to the right spot.
Here's a set of imperfect search & replace strings to convert
the input_port_read calls and fix up IPT_VBLANK:
input_port_read( *\( *)(machine\(\)) *, *([^)]+ *\))
ioport\1\3->read\(\)
input_port_read( *\( *)(.*machine[()]*) *, *([^)]+ *\))
\2\.root_device\(\)\.ioport\1\3->read\(\)
(state = .*driver_data[^}]+)space->machine\(\)\.root_device\(\)\.
\1state->
(state = .*driver_data[^}]+)device->machine\(\)\.root_device\(\)\.
\1state->
input_port_read_safe( *\( *)(machine\(\)) *, *([^,]+), *([^)]+\))
ioport\1\3->read_safe\(\4\)
IPT_VBLANK( *\))
IPT_CUSTOM\1 PORT_VBLANK("screen")
2012-05-03 11:00:08 +02:00
|
|
|
# add the error warning flag
|
2010-01-13 04:49:37 +01:00
|
|
|
ifndef NOWERROR
|
ioport.c C++ conversion. Mostly internal changes, with no
intended differences from previous behavior. For drivers,
the main change is that input_port_read() no longer exists.
Instead, the port must be fetched from the appropriate device,
and then read() is called.
For member functions, this is actually simpler/cleaner:
value = ioport("tag")->read()
For legacy functions which have a driver_data state, it goes:
value = state->ioport("tag")->read()
For other legacy functions, they need to fetch the root device:
value = machine.root_device().ioport("tag")->read()
The other big change for drivers is that IPT_VBLANK is gone.
Instead, it has been replaced by a device line callback on the
screen device. There's a new macro PORT_VBLANK("tag") which
automatically points things to the right spot.
Here's a set of imperfect search & replace strings to convert
the input_port_read calls and fix up IPT_VBLANK:
input_port_read( *\( *)(machine\(\)) *, *([^)]+ *\))
ioport\1\3->read\(\)
input_port_read( *\( *)(.*machine[()]*) *, *([^)]+ *\))
\2\.root_device\(\)\.ioport\1\3->read\(\)
(state = .*driver_data[^}]+)space->machine\(\)\.root_device\(\)\.
\1state->
(state = .*driver_data[^}]+)device->machine\(\)\.root_device\(\)\.
\1state->
input_port_read_safe( *\( *)(machine\(\)) *, *([^,]+), *([^)]+\))
ioport\1\3->read_safe\(\4\)
IPT_VBLANK( *\))
IPT_CUSTOM\1 PORT_VBLANK("screen")
2012-05-03 11:00:08 +02:00
|
|
|
CCOMFLAGS += -Werror
|
2010-01-13 04:49:37 +01:00
|
|
|
endif
|
ioport.c C++ conversion. Mostly internal changes, with no
intended differences from previous behavior. For drivers,
the main change is that input_port_read() no longer exists.
Instead, the port must be fetched from the appropriate device,
and then read() is called.
For member functions, this is actually simpler/cleaner:
value = ioport("tag")->read()
For legacy functions which have a driver_data state, it goes:
value = state->ioport("tag")->read()
For other legacy functions, they need to fetch the root device:
value = machine.root_device().ioport("tag")->read()
The other big change for drivers is that IPT_VBLANK is gone.
Instead, it has been replaced by a device line callback on the
screen device. There's a new macro PORT_VBLANK("tag") which
automatically points things to the right spot.
Here's a set of imperfect search & replace strings to convert
the input_port_read calls and fix up IPT_VBLANK:
input_port_read( *\( *)(machine\(\)) *, *([^)]+ *\))
ioport\1\3->read\(\)
input_port_read( *\( *)(.*machine[()]*) *, *([^)]+ *\))
\2\.root_device\(\)\.ioport\1\3->read\(\)
(state = .*driver_data[^}]+)space->machine\(\)\.root_device\(\)\.
\1state->
(state = .*driver_data[^}]+)device->machine\(\)\.root_device\(\)\.
\1state->
input_port_read_safe( *\( *)(machine\(\)) *, *([^,]+), *([^)]+\))
ioport\1\3->read_safe\(\4\)
IPT_VBLANK( *\))
IPT_CUSTOM\1 PORT_VBLANK("screen")
2012-05-03 11:00:08 +02:00
|
|
|
|
|
|
|
# if we are optimizing, include optimization options
|
|
|
|
ifneq ($(OPTIMIZE),0)
|
2010-01-13 04:49:37 +01:00
|
|
|
CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
|
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2009-02-28 23:10:06 +01:00
|
|
|
# add a basic set of warnings
|
|
|
|
CCOMFLAGS += \
|
|
|
|
-Wall \
|
|
|
|
-Wcast-align \
|
|
|
|
-Wundef \
|
|
|
|
-Wformat-security \
|
|
|
|
-Wwrite-strings \
|
2011-02-02 04:29:54 +01:00
|
|
|
-Wno-sign-compare \
|
|
|
|
-Wno-conversion
|
2009-02-28 23:10:06 +01:00
|
|
|
|
|
|
|
# warnings only applicable to C compiles
|
|
|
|
CONLYFLAGS += \
|
|
|
|
-Wpointer-arith \
|
|
|
|
-Wbad-function-cast \
|
|
|
|
-Wstrict-prototypes
|
|
|
|
|
2010-01-15 23:05:00 +01:00
|
|
|
# warnings only applicable to OBJ-C compiles
|
|
|
|
COBJFLAGS += \
|
|
|
|
-Wpointer-arith
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2012-01-25 06:11:03 +01:00
|
|
|
# warnings only applicable to C++ compiles
|
|
|
|
CPPONLYFLAGS += \
|
|
|
|
-Woverloaded-virtual
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2010-06-12 01:07:16 +02:00
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# include paths
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# add core include paths
|
2010-09-14 03:15:26 +02:00
|
|
|
INCPATH += \
|
2007-12-17 16:19:59 +01:00
|
|
|
-I$(SRC)/$(TARGET) \
|
|
|
|
-I$(OBJ)/$(TARGET)/layout \
|
|
|
|
-I$(SRC)/emu \
|
|
|
|
-I$(OBJ)/emu \
|
|
|
|
-I$(OBJ)/emu/layout \
|
|
|
|
-I$(SRC)/lib/util \
|
2011-05-06 21:42:26 +02:00
|
|
|
-I$(SRC)/lib \
|
2007-12-17 16:19:59 +01:00
|
|
|
-I$(SRC)/osd \
|
|
|
|
-I$(SRC)/osd/$(OSD) \
|
|
|
|
|
|
|
|
|
2010-09-14 03:15:26 +02:00
|
|
|
|
2010-02-14 18:44:34 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# archiving flags
|
|
|
|
#-------------------------------------------------
|
|
|
|
# Default to something reasonable for all platforms
|
|
|
|
ARFLAGS = -cr
|
|
|
|
# Deal with macosx brain damage if COMMAND_MODE is in
|
|
|
|
# the luser's environment:
|
|
|
|
ifeq ($(TARGETOS),macosx)
|
|
|
|
ifeq ($(COMMAND_MODE),"legacy")
|
|
|
|
ARFLAGS = -crs
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# linking flags
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# LDFLAGS are used generally; LDFLAGSEMULATOR are additional
|
|
|
|
# flags only used when linking the core emulator
|
2010-01-13 04:49:37 +01:00
|
|
|
LDFLAGS =
|
|
|
|
ifneq ($(TARGETOS),macosx)
|
|
|
|
ifneq ($(TARGETOS),os2)
|
|
|
|
ifneq ($(TARGETOS),solaris)
|
2007-12-17 16:19:59 +01:00
|
|
|
LDFLAGS = -Wl,--warn-common
|
2010-01-13 04:49:37 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
LDFLAGSEMULATOR =
|
|
|
|
|
|
|
|
# add profiling information for the linker
|
|
|
|
ifdef PROFILE
|
|
|
|
LDFLAGS += -pg
|
|
|
|
endif
|
|
|
|
|
|
|
|
# strip symbols and other metadata in non-symbols and non profiling builds
|
|
|
|
ifndef SYMBOLS
|
2010-01-13 04:49:37 +01:00
|
|
|
ifneq ($(TARGETOS),macosx)
|
2007-12-17 16:19:59 +01:00
|
|
|
LDFLAGS += -s
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# output a map file (emulator only)
|
|
|
|
ifdef MAP
|
|
|
|
LDFLAGSEMULATOR += -Wl,-Map,$(FULLNAME).map
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# define the standard object directory; other
|
|
|
|
# projects can add their object directories to
|
|
|
|
# this variable
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
2011-11-22 10:10:58 +01:00
|
|
|
OBJDIRS = $(OBJ) $(OBJ)/$(TARGET)/$(SUBTARGET)
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# define standard libarires for CPU and sounds
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
LIBEMU = $(OBJ)/libemu.a
|
2011-11-22 10:10:58 +01:00
|
|
|
LIBCPU = $(OBJ)/$(TARGET)/$(SUBTARGET)/libcpu.a
|
|
|
|
LIBDASM = $(OBJ)/$(TARGET)/$(SUBTARGET)/libdasm.a
|
|
|
|
LIBSOUND = $(OBJ)/$(TARGET)/$(SUBTARGET)/libsound.a
|
2007-12-17 16:19:59 +01:00
|
|
|
LIBUTIL = $(OBJ)/libutil.a
|
|
|
|
LIBOCORE = $(OBJ)/libocore.a
|
|
|
|
LIBOSD = $(OBJ)/libosd.a
|
|
|
|
|
|
|
|
VERSIONOBJ = $(OBJ)/version.o
|
2011-11-17 11:02:55 +01:00
|
|
|
EMUINFOOBJ = $(OBJ)/$(TARGET)/$(TARGET).o
|
2011-11-22 10:10:58 +01:00
|
|
|
DRIVLISTSRC = $(OBJ)/$(TARGET)/$(SUBTARGET)/drivlist.c
|
|
|
|
DRIVLISTOBJ = $(OBJ)/$(TARGET)/$(SUBTARGET)/drivlist.o
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# either build or link against the included
|
|
|
|
# libraries
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# start with an empty set of libs
|
|
|
|
LIBS =
|
|
|
|
|
|
|
|
# add expat XML library
|
2010-01-17 21:36:46 +01:00
|
|
|
ifeq ($(BUILD_EXPAT),1)
|
2010-09-14 03:15:26 +02:00
|
|
|
INCPATH += -I$(SRC)/lib/expat
|
2007-12-17 16:19:59 +01:00
|
|
|
EXPAT = $(OBJ)/libexpat.a
|
|
|
|
else
|
|
|
|
LIBS += -lexpat
|
|
|
|
EXPAT =
|
|
|
|
endif
|
|
|
|
|
|
|
|
# add ZLIB compression library
|
2010-01-17 21:36:46 +01:00
|
|
|
ifeq ($(BUILD_ZLIB),1)
|
2010-09-14 03:15:26 +02:00
|
|
|
INCPATH += -I$(SRC)/lib/zlib
|
2007-12-17 16:19:59 +01:00
|
|
|
ZLIB = $(OBJ)/libz.a
|
|
|
|
else
|
|
|
|
LIBS += -lz
|
|
|
|
ZLIB =
|
|
|
|
endif
|
|
|
|
|
2012-03-29 23:56:18 +02:00
|
|
|
# add flac library
|
|
|
|
ifeq ($(BUILD_FLAC),1)
|
|
|
|
INCPATH += -I$(SRC)/lib/util
|
|
|
|
FLAC_LIB = $(OBJ)/libflac.a
|
|
|
|
# $(OBJ)/libflac++.a
|
|
|
|
else
|
|
|
|
LIBS += -lFLAC
|
|
|
|
FLAC_LIB =
|
|
|
|
endif
|
|
|
|
|
|
|
|
# add jpeglib image library
|
|
|
|
ifeq ($(BUILD_JPEGLIB),1)
|
|
|
|
INCPATH += -I$(SRC)/lib/libjpeg
|
|
|
|
JPEG_LIB = $(OBJ)/libjpeg.a
|
|
|
|
else
|
|
|
|
LIBS += -ljpeg
|
|
|
|
JPEG_LIB =
|
|
|
|
endif
|
|
|
|
|
2010-03-02 05:26:48 +01:00
|
|
|
# add SoftFloat floating point emulation library
|
|
|
|
SOFTFLOAT = $(OBJ)/libsoftfloat.a
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2011-05-06 21:42:26 +02:00
|
|
|
# add formats emulation library
|
|
|
|
FORMATS_LIB = $(OBJ)/libformats.a
|
2010-06-12 01:07:16 +02:00
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
#-------------------------------------------------
|
2010-01-03 22:31:44 +01:00
|
|
|
# 'default' target needs to go here, before the
|
2007-12-17 16:19:59 +01:00
|
|
|
# include files which define additional targets
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
2010-01-03 22:31:44 +01:00
|
|
|
default: maketree buildtools emulator
|
|
|
|
|
|
|
|
all: default tools
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2009-02-28 23:10:06 +01:00
|
|
|
|
2012-02-12 18:55:51 +01:00
|
|
|
7Z_LIB = $(OBJ)/lib7z.a
|
|
|
|
|
2008-02-22 01:17:36 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# defines needed by multiple make files
|
|
|
|
#-------------------------------------------------
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2008-02-22 01:17:36 +01:00
|
|
|
BUILDSRC = $(SRC)/build
|
|
|
|
BUILDOBJ = $(OBJ)/build
|
|
|
|
BUILDOUT = $(BUILDOBJ)
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2009-02-28 23:10:06 +01:00
|
|
|
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# include the various .mak files
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# include OSD-specific rules first
|
|
|
|
include $(SRC)/osd/$(OSD)/$(OSD).mak
|
|
|
|
|
|
|
|
# then the various core pieces
|
|
|
|
include $(SRC)/$(TARGET)/$(SUBTARGET).mak
|
2011-11-22 10:10:58 +01:00
|
|
|
-include $(SRC)/$(TARGET)/osd/$(OSD)/$(OSD).mak
|
2007-12-17 16:19:59 +01:00
|
|
|
include $(SRC)/emu/emu.mak
|
|
|
|
include $(SRC)/lib/lib.mak
|
|
|
|
include $(SRC)/build/build.mak
|
2008-02-22 01:17:36 +01:00
|
|
|
-include $(SRC)/osd/$(CROSS_BUILD_OSD)/build.mak
|
2007-12-17 16:19:59 +01:00
|
|
|
include $(SRC)/tools/tools.mak
|
|
|
|
|
|
|
|
# combine the various definitions to one
|
2010-09-14 03:15:26 +02:00
|
|
|
CCOMFLAGS += $(INCPATH)
|
2010-01-02 21:21:00 +01:00
|
|
|
CDEFS = $(DEFS)
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# primary targets
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
emulator: maketree $(BUILD) $(EMULATOR)
|
|
|
|
|
|
|
|
buildtools: maketree $(BUILD)
|
|
|
|
|
2010-09-14 03:15:26 +02:00
|
|
|
# In order to keep dependencies reasonable, we exclude objects in the base of
|
|
|
|
# $(SRC)/emu, as well as all the OSD objects and anything in the $(OBJ) tree
|
|
|
|
depend: maketree $(MAKEDEP_TARGET)
|
|
|
|
@echo Rebuilding depend.mak...
|
2010-09-28 09:33:09 +02:00
|
|
|
$(MAKEDEP) -I. $(INCPATH) -X$(SRC)/emu -X$(SRC)/osd/... -X$(OBJ)/... src/$(TARGET) > depend.mak
|
2010-09-14 03:15:26 +02:00
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
tools: maketree $(TOOLS)
|
|
|
|
|
|
|
|
maketree: $(sort $(OBJDIRS))
|
|
|
|
|
2009-09-21 11:03:25 +02:00
|
|
|
clean: $(OSDCLEAN)
|
2007-12-17 16:19:59 +01:00
|
|
|
@echo Deleting object tree $(OBJ)...
|
|
|
|
$(RM) -r $(OBJ)
|
|
|
|
@echo Deleting $(EMULATOR)...
|
|
|
|
$(RM) $(EMULATOR)
|
|
|
|
@echo Deleting $(TOOLS)...
|
|
|
|
$(RM) $(TOOLS)
|
|
|
|
ifdef MAP
|
|
|
|
@echo Deleting $(FULLNAME).map...
|
|
|
|
$(RM) $(FULLNAME).map
|
|
|
|
endif
|
2011-02-12 23:17:46 +01:00
|
|
|
ifdef SYMBOLS
|
|
|
|
@echo Deleting $(FULLNAME).sym...
|
|
|
|
$(RM) $(FULLNAME).sym
|
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2010-01-17 21:26:49 +01:00
|
|
|
checkautodetect:
|
|
|
|
@echo TARGETOS=$(TARGETOS)
|
|
|
|
@echo PTR64=$(PTR64)
|
|
|
|
@echo BIGENDIAN=$(BIGENDIAN)
|
|
|
|
@echo UNAME="$(UNAME)"
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# directory targets
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
$(sort $(OBJDIRS)):
|
|
|
|
$(MD) -p $@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# executable targets and dependencies
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
2007-12-17 17:41:39 +01:00
|
|
|
ifndef EXECUTABLE_DEFINED
|
|
|
|
|
2012-02-23 15:19:37 +01:00
|
|
|
$(EMULATOR): $(VERSIONOBJ) $(EMUINFOOBJ) $(DRIVLISTOBJ) $(DRVLIBS) $(LIBOSD) $(LIBCPU) $(LIBEMU) $(LIBDASM) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(JPEG_LIB) $(FLAC_LIB) $(7Z_LIB) $(FORMATS_LIB) $(ZLIB) $(LIBOCORE) $(RESFILE)
|
Major CHD/chdman update. The CHD version number has been increased
from 4 to 5. This means any diff CHDs will no longer work. If you
absolutely need to keep the data for any existing ones you have,
find both the diff CHD and the original CHD for the game in question
and upgrade using these commands:
rename diff\game.dif diff\game-old.dif
chdman copy -i diff\game-old.dif -ip roms\game.chd -o diff\game.dif -op roms\game.chd -c none
Specifics regarding this change:
Defined a new CHD version 5. New features/behaviors of this version:
- support for up to 4 codecs; each block can use 1 of the 4
- new LZMA codec, which tends to do better than zlib overall
- new FLAC codec, primarily used for CDs (but can be applied anywhere)
- upgraded AVHuff codec now uses FLAC for encoding audio
- new Huffman codec, used to catch more nearly-uncompressable blocks
- compressed CHDs now use a compressed map for significant savings
- CHDs now are aware of a "unit" size; each hunk holds 1 or more units
(in general units map to sectors for hard disks/CDs)
- diff'ing against a parent now diffs at the unit level, greatly
improving compression
Rewrote and modernized chd.c. CHD versions prior to 3 are unsupported,
and version 3/4 CHDs are only supported for reading. Creating a new
CHD now leaves the file open. Added methods to read and write at the
unit and byte level, removing the need to handle this manually. Added
metadata access methods that pass astrings and dynamic_buffers to
simplify the interfaces. A companion class chd_compressor now
implements full multithreaded compression, analyzing and compressing
multiple hunks independently in parallel. Split the codec
implementations out into a separate file chdcodec.*
Updated harddisk.c and cdrom.c to rely on the caching/byte-level read/
write capabilities of the chd_file class. cdrom.c (and chdman) now also
pad CDs to 4-frame boundaries instead of hunk boundaries, ensuring that
the same SHA1 hashes are produced regardless of the hunk size.
Rewrote chdman.exe entirely, switching from positional parameters to
proper options. Use "chdman help" to get a list of commands, and
"chdman help <command>" to get help for any particular command. Many
redundant commands were removed now that additional flexibility is
available. Some basic mappings:
Old: chdman -createblankhd <out.chd> <cyls> <heads> <secs>
New: chdman createhd -o <out.chd> -chs <cyls>,<heads>,<secs>
Old: chdman -createuncomphd <in.raw> <out.chd> ....
New: chdman createhd -i <in.raw> -o <out.chd> -c none ....
Old: chdman -verifyfix <in.chd>
New: chdman verify -i <in.chd> -f
Old: chdman -merge <parent.chd> <diff.chd> <out.chd>
New: chdman copy -i <diff.chd> -ip <parent.chd> -o <out.chd>
Old: chdman -diff <parent.chd> <compare.chd> <diff.chd>
New: chdman copy -i <compare.chd> -o <diff.chd> -op <parent.chd>
Old: chdman -update <in.chd> <out.chd>
New: chdman copy -i <in.chd> -o <out.chd>
Added new core file coretmpl.h to hold core template classes. For now
just one class, dynamic_array<> is defined, which acts like an array
of a given object but which can be appended to and/or resized. Also
defines dynamic_buffer as dynamic_array<UINT8> for holding an
arbitrary buffer of bytes. Expect to see these used a lot.
Added new core helper hashing.c/.h which defines classes for each of
the common hashing methods and creator classes to wrap the
computation of these hashes. A future work item is to reimplement
the core emulator hashing code using these.
Split bit buffer helpers out into C++ classes and into their own
public header in bitstream.h.
Updated huffman.c/.h to C++, and changed the interface to make it
more flexible to use in nonstandard ways. Also added huffman compression
of the static tree for slightly better compression rates.
Created flac.c/.h as simplified C++ wrappers around the FLAC interface.
A future work item is to convert the samples sound device to a modern
device and leverage this for reading FLAC files.
Renamed avcomp.* to avhuff.*, updated to C++, and added support for
FLAC as the audio encoding mechanism. The old huffman audio is still
supported for decode only.
Added a variant of core_fload that loads to a dynamic_buffer.
Tweaked winwork.c a bit to not limit the maximum number of processors
unless the work queue was created with the WORK_QUEUE_FLAG_HIGH_FREQ
option. Further adjustments here are likely going to be necessary.
Fixed bug in aviio.c which caused errors when reading some AVI files.
2012-02-16 10:47:18 +01:00
|
|
|
$(CC) $(CDEFS) $(CFLAGS) -c $(SRC)/version.c -o $(VERSIONOBJ)
|
2007-12-17 16:19:59 +01:00
|
|
|
@echo Linking $@...
|
|
|
|
$(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $^ $(LIBS) -o $@
|
2010-07-02 05:49:56 +02:00
|
|
|
ifeq ($(TARGETOS),win32)
|
|
|
|
ifdef SYMBOLS
|
|
|
|
$(OBJDUMP) --section=.text --line-numbers --syms --demangle $@ >$(FULLNAME).sym
|
|
|
|
endif
|
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2007-12-17 17:41:39 +01:00
|
|
|
endif
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# generic rules
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
$(OBJ)/%.o: $(SRC)/%.c | $(OSPREBUILD)
|
|
|
|
@echo Compiling $<...
|
|
|
|
$(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
$(OBJ)/%.pp: $(SRC)/%.c | $(OSPREBUILD)
|
|
|
|
@echo Compiling $<...
|
|
|
|
$(CC) $(CDEFS) $(CFLAGS) -E $< -o $@
|
|
|
|
|
|
|
|
$(OBJ)/%.s: $(SRC)/%.c | $(OSPREBUILD)
|
|
|
|
@echo Compiling $<...
|
|
|
|
$(CC) $(CDEFS) $(CFLAGS) -S $< -o $@
|
|
|
|
|
2010-09-14 03:15:26 +02:00
|
|
|
$(OBJ)/%.lh: $(SRC)/%.lay $(FILE2STR_TARGET)
|
2007-12-17 16:19:59 +01:00
|
|
|
@echo Converting $<...
|
|
|
|
@$(FILE2STR) $< $@ layout_$(basename $(notdir $<))
|
|
|
|
|
2010-09-14 03:15:26 +02:00
|
|
|
$(OBJ)/%.fh: $(SRC)/%.png $(PNG2BDC_TARGET) $(FILE2STR_TARGET)
|
2007-12-17 16:19:59 +01:00
|
|
|
@echo Converting $<...
|
|
|
|
@$(PNG2BDC) $< $(OBJ)/temp.bdc
|
|
|
|
@$(FILE2STR) $(OBJ)/temp.bdc $@ font_$(basename $(notdir $<)) UINT8
|
|
|
|
|
(Big tangle of changes that all happened as I was looking into the ROM
loader rewrite, which is still in progress....)
Replaced mamedriv.c with a new driver list mechanism that is generated
by the build tools. The emulator core now expects the presence of a
file called src/$(TARGET)/$(SUBTARGET).lst which is just a raw list of
driver names, one per line. C and C++ comments are still permitted.
This file is parsed by a new build tool makelist which extracts the
driver names, sorts them, and generates a file called drivlist.c, which
is consumed by the core. [Aaron Giles]
Added new osdcore function osd_malloc_array() which is identical to
osd_malloc() but obviously hints that the underlying allocation is for
an array. Updated all callers to use the appropriate form. Modified the
Windows allocator to only use guard pages for array-style allocations,
allowing us to enable them once again in debug builds. [Aaron Giles]
Created new static class driver_list to wrap accesses to the list of
available drivers. Improved speed of driver lookups by relying on the
presorting done by makelist. [Aaron Giles]
Created helper class driver_enumerator as a helper for iterating through
the list of drivers. This class supports basic filtering and iteration,
and also serves as a temporary cache of machine_configs. [Aaron Giles]
Created cli_frontend object to wrap all the CLI handling code in
clifront.c. Updated/simplified all the code to take advantage of the
driver_enumerator. [Aaron Giles]
Created media_auditor object to wrap all the auditing functions in
audit.c. Updated all users to the new interface. Note that the new
auditing mechanism is slightly out of sync with the romload code in
terms of finding ROMs owned by devices, so it may mis-report some
issues until the new ROM loading code is in. [Aaron Giles]
Added concept of a per-device searchpath. For most devices, their
searchpath is just the short name of the device. For driver_devices, the
searchpath is driver[;parent[;bios]]. This searchpath will eventually be
used by the rom loader to find ROMs. For now it is used by the media
auditor only. [Aaron Giles]
Created info_xml_creator object to wrap all the info generation functions
in info.c. Converted the file to C++ and cleaned up the input processing
code. [Aaron Giles]
(not for whatsnew ... Known issues: auditing of CHDs appears busted, and
debug builds report unfreed memory if you use the built-in game picker)
2011-04-13 22:31:00 +02:00
|
|
|
$(DRIVLISTOBJ): $(DRIVLISTSRC)
|
|
|
|
@echo Compiling $<...
|
|
|
|
$(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
$(DRIVLISTSRC): $(SRC)/$(TARGET)/$(SUBTARGET).lst $(MAKELIST_TARGET)
|
|
|
|
@echo Building driver list $<...
|
|
|
|
@$(MAKELIST) $< >$@
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
$(OBJ)/%.a:
|
|
|
|
@echo Archiving $@...
|
|
|
|
$(RM) $@
|
2010-02-14 18:44:34 +01:00
|
|
|
$(AR) $(ARFLAGS) $@ $^
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
ifeq ($(TARGETOS),macosx)
|
|
|
|
$(OBJ)/%.o: $(SRC)/%.m | $(OSPREBUILD)
|
|
|
|
@echo Objective-C compiling $<...
|
2010-01-15 23:05:00 +01:00
|
|
|
$(CC) $(CDEFS) $(COBJFLAGS) $(CCOMFLAGS) -c $< -o $@
|
2007-12-17 16:19:59 +01:00
|
|
|
endif
|
2010-01-16 14:02:03 +01:00
|
|
|
|
2010-09-14 03:15:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# optional dependencies file
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
-include depend.mak
|