mirror of
https://github.com/holub/mame
synced 2025-10-04 16:34:53 +03:00
Changes to sync with new toolchain:
1. Removed CPP_COMPILE option. All files (except expat and zlib) are now compiled as C++ by default. For now, imagine nothing has changed. The goal is not to go hog-wild with C++isms, but to leverage it where it makes the most sense. 2. Mapped INLINE to plain old C++ inline now, fixing several cases where this was problematic. 3. Marked global const structures explicitly extern since consts are locally-scoped by default in C++. 4. Added new 'default' make target which just builds the emulator. Use 'make all' to build everything including the tools. 5. 64-bit builds now get a '64' suffix on them. We might want to just make this true for Windows builds, but it's on for everyone at the moment. 6. (Windows) Removed UNICODE option. UNICODE is enabled by default on all Windows builds now. The 32-bit version links against libunicows.a for continued Win9x compatibility. 7. (Windows) Removed hacks surrounding unicode handling of main(). They are no longer necessary with the new tools.
This commit is contained in:
parent
aba256db9a
commit
b4099c91bc
38
makefile
38
makefile
@ -143,9 +143,6 @@ BUILD_ZLIB = 1
|
|||||||
# (default is OPTIMIZE = 3 normally, or OPTIMIZE = 0 with symbols)
|
# (default is OPTIMIZE = 3 normally, or OPTIMIZE = 0 with symbols)
|
||||||
# OPTIMIZE = 3
|
# OPTIMIZE = 3
|
||||||
|
|
||||||
# experimental: uncomment to compile everything as C++ for stricter type checking
|
|
||||||
# CPP_COMPILE = 1
|
|
||||||
|
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
################## END USER-CONFIGURABLE OPTIONS ######################
|
################## END USER-CONFIGURABLE OPTIONS ######################
|
||||||
@ -195,7 +192,7 @@ endif
|
|||||||
# compiler, linker and utilities
|
# compiler, linker and utilities
|
||||||
AR = @ar
|
AR = @ar
|
||||||
CC = @gcc
|
CC = @gcc
|
||||||
LD = @gcc
|
LD = @g++
|
||||||
MD = -mkdir$(EXE)
|
MD = -mkdir$(EXE)
|
||||||
RM = @rm -f
|
RM = @rm -f
|
||||||
|
|
||||||
@ -205,14 +202,14 @@ RM = @rm -f
|
|||||||
# form the name of the executable
|
# form the name of the executable
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
# debug builds just get the 'd' suffix and nothing more
|
# 64-bit builds get a '64' suffix
|
||||||
ifdef DEBUG
|
ifdef PTR64
|
||||||
DEBUGSUFFIX = d
|
SUFFIX64 = 64
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# cpp builds get a 'pp' suffix
|
# debug builds just get the 'd' suffix and nothing more
|
||||||
ifdef CPP_COMPILE
|
ifdef DEBUG
|
||||||
CPPSUFFIX = pp
|
SUFFIXDEBUG = d
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# the name is just 'target' if no subtarget; otherwise it is
|
# the name is just 'target' if no subtarget; otherwise it is
|
||||||
@ -223,8 +220,8 @@ else
|
|||||||
NAME = $(TARGET)$(SUBTARGET)
|
NAME = $(TARGET)$(SUBTARGET)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# fullname is prefix+name+suffix+debugsuffix
|
# fullname is prefix+name+suffix+suffix64+suffixdebug
|
||||||
FULLNAME = $(PREFIX)$(NAME)$(CPPSUFFIX)$(SUFFIX)$(DEBUGSUFFIX)
|
FULLNAME = $(PREFIX)$(NAME)$(SUFFIX)$(SUFFIX64)$(SUFFIXDEBUG)
|
||||||
|
|
||||||
# add an EXE suffix to get the final emulator name
|
# add an EXE suffix to get the final emulator name
|
||||||
EMULATOR = $(FULLNAME)$(EXE)
|
EMULATOR = $(FULLNAME)$(EXE)
|
||||||
@ -258,7 +255,7 @@ DEFS = -DCRLF=3
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# map the INLINE to something digestible by GCC
|
# map the INLINE to something digestible by GCC
|
||||||
DEFS += -DINLINE="static __inline__"
|
DEFS += -DINLINE=inline
|
||||||
|
|
||||||
# define LSB_FIRST if we are a little-endian target
|
# define LSB_FIRST if we are a little-endian target
|
||||||
ifndef BIGENDIAN
|
ifndef BIGENDIAN
|
||||||
@ -298,11 +295,7 @@ CPPONLYFLAGS =
|
|||||||
|
|
||||||
# CFLAGS is defined based on C or C++ targets
|
# CFLAGS is defined based on C or C++ targets
|
||||||
# (remember, expansion only happens when used, so doing it here is ok)
|
# (remember, expansion only happens when used, so doing it here is ok)
|
||||||
ifdef CPP_COMPILE
|
|
||||||
CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
|
CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
|
||||||
else
|
|
||||||
CFLAGS = $(CCOMFLAGS) $(CONLYFLAGS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# we compile C-only to C89 standard with GNU extensions
|
# we compile C-only to C89 standard with GNU extensions
|
||||||
# we compile C++ code to C++98 standard with GNU extensions
|
# we compile C++ code to C++98 standard with GNU extensions
|
||||||
@ -351,11 +344,6 @@ CONLYFLAGS += \
|
|||||||
-Wbad-function-cast \
|
-Wbad-function-cast \
|
||||||
-Wstrict-prototypes
|
-Wstrict-prototypes
|
||||||
|
|
||||||
# this warning is not supported on the os2 compilers
|
|
||||||
ifneq ($(TARGETOS),os2)
|
|
||||||
CONLYFLAGS += -Wdeclaration-after-statement
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
@ -458,11 +446,13 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
# 'all' target needs to go here, before the
|
# 'default' target needs to go here, before the
|
||||||
# include files which define additional targets
|
# include files which define additional targets
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
all: maketree buildtools emulator tools
|
default: maketree buildtools emulator
|
||||||
|
|
||||||
|
all: default tools
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -793,7 +793,7 @@ static void HandleCoProcDT(arm_state *cpustate, UINT32 insn)
|
|||||||
SET_REGISTER(cpustate, rn, ornv);
|
SET_REGISTER(cpustate, rn, ornv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HandleBranch(arm_state *cpustate, UINT32 insn)
|
INLINE void HandleBranch(arm_state *cpustate, UINT32 insn)
|
||||||
{
|
{
|
||||||
UINT32 off = (insn & INSN_BRANCH) << 2;
|
UINT32 off = (insn & INSN_BRANCH) << 2;
|
||||||
|
|
||||||
|
@ -319,8 +319,7 @@ static const UINT32 condition_map[] =
|
|||||||
|
|
||||||
static UINT64 immediate_zero = 0;
|
static UINT64 immediate_zero = 0;
|
||||||
|
|
||||||
extern const drcbe_interface drcbe_c_be_interface;
|
extern const drcbe_interface drcbe_c_be_interface =
|
||||||
const drcbe_interface drcbe_c_be_interface =
|
|
||||||
{
|
{
|
||||||
drcbec_alloc,
|
drcbec_alloc,
|
||||||
drcbec_free,
|
drcbec_free,
|
||||||
|
@ -327,7 +327,7 @@ static void debug_log_hashjmp(int mode, offs_t pc);
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/* globally-accessible interface to the backend */
|
/* globally-accessible interface to the backend */
|
||||||
const drcbe_interface drcbe_x64_be_interface =
|
extern const drcbe_interface drcbe_x64_be_interface =
|
||||||
{
|
{
|
||||||
drcbex64_alloc,
|
drcbex64_alloc,
|
||||||
drcbex64_free,
|
drcbex64_free,
|
||||||
|
@ -226,8 +226,7 @@ static int ddivs(UINT64 *dstlo, UINT64 *dsthi, INT64 src1, INT64 src2);
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/* globally-accessible interface to the backend */
|
/* globally-accessible interface to the backend */
|
||||||
extern const drcbe_interface drcbe_x86_be_interface;
|
extern const drcbe_interface drcbe_x86_be_interface =
|
||||||
const drcbe_interface drcbe_x86_be_interface =
|
|
||||||
{
|
{
|
||||||
drcbex86_alloc,
|
drcbex86_alloc,
|
||||||
drcbex86_free,
|
drcbex86_free,
|
||||||
|
@ -381,7 +381,7 @@ INLINE void superfx_rambuffer_write(superfx_state *cpustate, UINT16 addr, UINT8
|
|||||||
cpustate->ramdr = data;
|
cpustate->ramdr = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void superfx_rombuffer_sync(superfx_state *cpustate)
|
INLINE void superfx_rombuffer_sync(superfx_state *cpustate)
|
||||||
{
|
{
|
||||||
if(cpustate->romcl)
|
if(cpustate->romcl)
|
||||||
{
|
{
|
||||||
@ -389,13 +389,13 @@ static void superfx_rombuffer_sync(superfx_state *cpustate)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void superfx_rombuffer_update(superfx_state *cpustate)
|
INLINE void superfx_rombuffer_update(superfx_state *cpustate)
|
||||||
{
|
{
|
||||||
cpustate->sfr |= SUPERFX_SFR_R;
|
cpustate->sfr |= SUPERFX_SFR_R;
|
||||||
cpustate->romcl = cpustate->memory_access_speed;
|
cpustate->romcl = cpustate->memory_access_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT8 superfx_rombuffer_read(superfx_state *cpustate)
|
INLINE UINT8 superfx_rombuffer_read(superfx_state *cpustate)
|
||||||
{
|
{
|
||||||
superfx_rombuffer_sync(cpustate);
|
superfx_rombuffer_sync(cpustate);
|
||||||
return cpustate->romdr;
|
return cpustate->romdr;
|
||||||
|
@ -200,7 +200,7 @@ struct _game_driver
|
|||||||
GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,((const char *)0))
|
GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,((const char *)0))
|
||||||
|
|
||||||
#define GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,LAYOUT) \
|
#define GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,LAYOUT) \
|
||||||
const game_driver GAME_NAME(NAME) = \
|
extern const game_driver GAME_NAME(NAME) = \
|
||||||
{ \
|
{ \
|
||||||
__FILE__, \
|
__FILE__, \
|
||||||
#PARENT, \
|
#PARENT, \
|
||||||
|
@ -1089,7 +1089,7 @@ static void dinput_init(running_machine *machine)
|
|||||||
int didevtype_joystick = DI8DEVCLASS_GAMECTRL;
|
int didevtype_joystick = DI8DEVCLASS_GAMECTRL;
|
||||||
|
|
||||||
dinput_version = DIRECTINPUT_VERSION;
|
dinput_version = DIRECTINPUT_VERSION;
|
||||||
result = DirectInput8Create(GetModuleHandle(NULL), dinput_version, &IID_IDirectInput8, (void *)&dinput, NULL);
|
result = DirectInput8Create(GetModuleHandle(NULL), dinput_version, IID_IDirectInput8, (void **)&dinput, NULL);
|
||||||
if (result != DI_OK)
|
if (result != DI_OK)
|
||||||
{
|
{
|
||||||
dinput_version = 0;
|
dinput_version = 0;
|
||||||
|
@ -61,28 +61,11 @@ extern int utf8_main(int argc, char *argv[]);
|
|||||||
#undef wmain
|
#undef wmain
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
extern "C" int _tmain(int argc, TCHAR **argv)
|
||||||
int main(int argc, char **a_argv)
|
|
||||||
#else // !__GNUC__
|
|
||||||
int _tmain(int argc, TCHAR **argv)
|
|
||||||
#endif // __GNUC__
|
|
||||||
{
|
{
|
||||||
int i, rc;
|
int i, rc;
|
||||||
char **utf8_argv;
|
char **utf8_argv;
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
TCHAR **argv;
|
|
||||||
#ifdef UNICODE
|
|
||||||
// MinGW doesn't support wmain() directly, so we have to jump through some hoops
|
|
||||||
extern void __wgetmainargs(int *argc, wchar_t ***wargv, wchar_t ***wenviron, int expand_wildcards, int *startupinfo);
|
|
||||||
WCHAR **wenviron;
|
|
||||||
int startupinfo;
|
|
||||||
__wgetmainargs(&argc, &argv, &wenviron, 0, &startupinfo);
|
|
||||||
#else // !UNICODE
|
|
||||||
argv = a_argv;
|
|
||||||
#endif // UNICODE
|
|
||||||
#endif // __GNUC__
|
|
||||||
|
|
||||||
#ifdef MALLOC_DEBUG
|
#ifdef MALLOC_DEBUG
|
||||||
{
|
{
|
||||||
extern int winalloc_in_main_code;
|
extern int winalloc_in_main_code;
|
||||||
|
@ -54,14 +54,6 @@
|
|||||||
# uncomment next line to use cygwin compiler
|
# uncomment next line to use cygwin compiler
|
||||||
# CYGWIN_BUILD = 1
|
# CYGWIN_BUILD = 1
|
||||||
|
|
||||||
# uncomment next line to enable multi-monitor stubs on Windows 95/NT
|
|
||||||
# you will need to find multimon.h and put it into your include
|
|
||||||
# path in order to make this work
|
|
||||||
# WIN95_MULTIMON = 1
|
|
||||||
|
|
||||||
# uncomment next line to enable a Unicode build
|
|
||||||
# UNICODE = 1
|
|
||||||
|
|
||||||
# set this to the minimum Direct3D version to support (8 or 9)
|
# set this to the minimum Direct3D version to support (8 or 9)
|
||||||
# DIRECT3D = 9
|
# DIRECT3D = 9
|
||||||
|
|
||||||
@ -75,19 +67,6 @@
|
|||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------
|
|
||||||
# overrides
|
|
||||||
#-------------------------------------------------
|
|
||||||
|
|
||||||
# turn on unicode for all 64-bit builds regardless
|
|
||||||
ifndef UNICODE
|
|
||||||
ifdef PTR64
|
|
||||||
UNICODE = 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
# object and source roots
|
# object and source roots
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
@ -155,18 +134,15 @@ LDFLAGS += /LTCG
|
|||||||
AR += /LTCG
|
AR += /LTCG
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# disable warnings and link against bufferoverflowu for 64-bit targets
|
||||||
ifdef PTR64
|
ifdef PTR64
|
||||||
CCOMFLAGS += /wd4267
|
CCOMFLAGS += /wd4267
|
||||||
|
LIBS += -lbufferoverflowu
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# disable function pointer warnings in C++ which are evil to work around
|
# disable function pointer warnings in C++ which are evil to work around
|
||||||
CPPONLYFLAGS += /wd4191 /wd4060 /wd4065 /wd4640
|
CPPONLYFLAGS += /wd4191 /wd4060 /wd4065 /wd4640
|
||||||
|
|
||||||
# explicitly set the entry point for UNICODE builds
|
|
||||||
ifdef UNICODE
|
|
||||||
LDFLAGS += /ENTRY:wmainCRTStartup
|
|
||||||
endif
|
|
||||||
|
|
||||||
# add some VC++-specific defines
|
# add some VC++-specific defines
|
||||||
DEFS += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DXML_STATIC -D__inline__=__inline -Dsnprintf=_snprintf
|
DEFS += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DXML_STATIC -D__inline__=__inline -Dsnprintf=_snprintf
|
||||||
|
|
||||||
@ -213,6 +189,10 @@ CURPATH = ./
|
|||||||
# define the x64 ABI to be Windows
|
# define the x64 ABI to be Windows
|
||||||
DEFS += -DX64_WINDOWS_ABI
|
DEFS += -DX64_WINDOWS_ABI
|
||||||
|
|
||||||
|
# enable UNICODE flags
|
||||||
|
DEFS += -DUNICODE -D_UNICODE
|
||||||
|
LDFLAGS += -municode
|
||||||
|
|
||||||
# map all instances of "main" to "utf8_main"
|
# map all instances of "main" to "utf8_main"
|
||||||
DEFS += -Dmain=utf8_main
|
DEFS += -Dmain=utf8_main
|
||||||
|
|
||||||
@ -222,11 +202,6 @@ DEFS += -DMALLOC_DEBUG
|
|||||||
LDFLAGS += -Wl,--allow-multiple-definition
|
LDFLAGS += -Wl,--allow-multiple-definition
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# enable UNICODE flags for unicode builds
|
|
||||||
ifdef UNICODE
|
|
||||||
DEFS += -DUNICODE -D_UNICODE
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
@ -236,18 +211,14 @@ endif
|
|||||||
# add our prefix files to the mix
|
# add our prefix files to the mix
|
||||||
CCOMFLAGS += -include $(WINSRC)/winprefix.h
|
CCOMFLAGS += -include $(WINSRC)/winprefix.h
|
||||||
|
|
||||||
ifdef WIN95_MULTIMON
|
# for 32-bit apps, add unicows for Unicode support on Win9x
|
||||||
CCOMFLAGS += -DWIN95_MULTIMON
|
ifndef PTR64
|
||||||
|
LIBS += -lunicows
|
||||||
|
LDFLAGS += -static-libgcc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# add the windows libraries
|
# add the windows libraries
|
||||||
LIBS += -luser32 -lgdi32 -lddraw -ldsound -ldxguid -lwinmm -ladvapi32 -lcomctl32 -lshlwapi
|
LIBS += -luser32 -lgdi32 -lddraw -ldsound -ldxguid -lwinmm -ladvapi32 -lcomctl32 -lshlwapi -ldinput8
|
||||||
|
|
||||||
ifdef CPP_COMPILE
|
|
||||||
ifndef MSVC_BUILD
|
|
||||||
LIBS += -lsupc++
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(DIRECTINPUT),8)
|
ifeq ($(DIRECTINPUT),8)
|
||||||
LIBS += -ldinput8
|
LIBS += -ldinput8
|
||||||
@ -257,14 +228,6 @@ LIBS += -ldinput
|
|||||||
CCOMFLAGS += -DDIRECTINPUT_VERSION=0x0700
|
CCOMFLAGS += -DDIRECTINPUT_VERSION=0x0700
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef PTR64
|
|
||||||
ifdef MSVC_BUILD
|
|
||||||
LIBS += -lbufferoverflowu
|
|
||||||
else
|
|
||||||
DEFS += -D_COM_interface=struct
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user