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:
Aaron Giles 2010-01-03 21:31:44 +00:00
parent aba256db9a
commit b4099c91bc
10 changed files with 35 additions and 101 deletions

View File

@ -143,9 +143,6 @@ BUILD_ZLIB = 1
# (default is OPTIMIZE = 3 normally, or OPTIMIZE = 0 with symbols)
# OPTIMIZE = 3
# experimental: uncomment to compile everything as C++ for stricter type checking
# CPP_COMPILE = 1
###########################################################################
################## END USER-CONFIGURABLE OPTIONS ######################
@ -195,7 +192,7 @@ endif
# compiler, linker and utilities
AR = @ar
CC = @gcc
LD = @gcc
LD = @g++
MD = -mkdir$(EXE)
RM = @rm -f
@ -205,14 +202,14 @@ RM = @rm -f
# form the name of the executable
#-------------------------------------------------
# debug builds just get the 'd' suffix and nothing more
ifdef DEBUG
DEBUGSUFFIX = d
# 64-bit builds get a '64' suffix
ifdef PTR64
SUFFIX64 = 64
endif
# cpp builds get a 'pp' suffix
ifdef CPP_COMPILE
CPPSUFFIX = pp
# debug builds just get the 'd' suffix and nothing more
ifdef DEBUG
SUFFIXDEBUG = d
endif
# the name is just 'target' if no subtarget; otherwise it is
@ -223,8 +220,8 @@ else
NAME = $(TARGET)$(SUBTARGET)
endif
# fullname is prefix+name+suffix+debugsuffix
FULLNAME = $(PREFIX)$(NAME)$(CPPSUFFIX)$(SUFFIX)$(DEBUGSUFFIX)
# fullname is prefix+name+suffix+suffix64+suffixdebug
FULLNAME = $(PREFIX)$(NAME)$(SUFFIX)$(SUFFIX64)$(SUFFIXDEBUG)
# add an EXE suffix to get the final emulator name
EMULATOR = $(FULLNAME)$(EXE)
@ -258,7 +255,7 @@ DEFS = -DCRLF=3
endif
# 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
ifndef BIGENDIAN
@ -298,11 +295,7 @@ CPPONLYFLAGS =
# CFLAGS is defined based on C or C++ targets
# (remember, expansion only happens when used, so doing it here is ok)
ifdef CPP_COMPILE
CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
else
CFLAGS = $(CCOMFLAGS) $(CONLYFLAGS)
endif
# we compile C-only to C89 standard with GNU extensions
# we compile C++ code to C++98 standard with GNU extensions
@ -351,11 +344,6 @@ CONLYFLAGS += \
-Wbad-function-cast \
-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
#-------------------------------------------------
all: maketree buildtools emulator tools
default: maketree buildtools emulator
all: default tools

View File

@ -793,7 +793,7 @@ static void HandleCoProcDT(arm_state *cpustate, UINT32 insn)
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;

View File

@ -319,8 +319,7 @@ static const UINT32 condition_map[] =
static UINT64 immediate_zero = 0;
extern const drcbe_interface drcbe_c_be_interface;
const drcbe_interface drcbe_c_be_interface =
extern const drcbe_interface drcbe_c_be_interface =
{
drcbec_alloc,
drcbec_free,

View File

@ -327,7 +327,7 @@ static void debug_log_hashjmp(int mode, offs_t pc);
***************************************************************************/
/* globally-accessible interface to the backend */
const drcbe_interface drcbe_x64_be_interface =
extern const drcbe_interface drcbe_x64_be_interface =
{
drcbex64_alloc,
drcbex64_free,

View File

@ -226,8 +226,7 @@ static int ddivs(UINT64 *dstlo, UINT64 *dsthi, INT64 src1, INT64 src2);
***************************************************************************/
/* globally-accessible interface to the backend */
extern const drcbe_interface drcbe_x86_be_interface;
const drcbe_interface drcbe_x86_be_interface =
extern const drcbe_interface drcbe_x86_be_interface =
{
drcbex86_alloc,
drcbex86_free,

View File

@ -381,7 +381,7 @@ INLINE void superfx_rambuffer_write(superfx_state *cpustate, UINT16 addr, UINT8
cpustate->ramdr = data;
}
static void superfx_rombuffer_sync(superfx_state *cpustate)
INLINE void superfx_rombuffer_sync(superfx_state *cpustate)
{
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->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);
return cpustate->romdr;

View File

@ -200,7 +200,7 @@ struct _game_driver
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) \
const game_driver GAME_NAME(NAME) = \
extern const game_driver GAME_NAME(NAME) = \
{ \
__FILE__, \
#PARENT, \

View File

@ -1089,7 +1089,7 @@ static void dinput_init(running_machine *machine)
int didevtype_joystick = DI8DEVCLASS_GAMECTRL;
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)
{
dinput_version = 0;

View File

@ -61,28 +61,11 @@ extern int utf8_main(int argc, char *argv[]);
#undef wmain
#endif
#ifdef __GNUC__
int main(int argc, char **a_argv)
#else // !__GNUC__
int _tmain(int argc, TCHAR **argv)
#endif // __GNUC__
extern "C" int _tmain(int argc, TCHAR **argv)
{
int i, rc;
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
{
extern int winalloc_in_main_code;

View File

@ -54,14 +54,6 @@
# uncomment next line to use cygwin compiler
# 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)
# 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
#-------------------------------------------------
@ -155,18 +134,15 @@ LDFLAGS += /LTCG
AR += /LTCG
endif
# disable warnings and link against bufferoverflowu for 64-bit targets
ifdef PTR64
CCOMFLAGS += /wd4267
LIBS += -lbufferoverflowu
endif
# disable function pointer warnings in C++ which are evil to work around
CPPONLYFLAGS += /wd4191 /wd4060 /wd4065 /wd4640
# explicitly set the entry point for UNICODE builds
ifdef UNICODE
LDFLAGS += /ENTRY:wmainCRTStartup
endif
# add some VC++-specific defines
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
DEFS += -DX64_WINDOWS_ABI
# enable UNICODE flags
DEFS += -DUNICODE -D_UNICODE
LDFLAGS += -municode
# map all instances of "main" to "utf8_main"
DEFS += -Dmain=utf8_main
@ -222,11 +202,6 @@ DEFS += -DMALLOC_DEBUG
LDFLAGS += -Wl,--allow-multiple-definition
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
CCOMFLAGS += -include $(WINSRC)/winprefix.h
ifdef WIN95_MULTIMON
CCOMFLAGS += -DWIN95_MULTIMON
# for 32-bit apps, add unicows for Unicode support on Win9x
ifndef PTR64
LIBS += -lunicows
LDFLAGS += -static-libgcc
endif
# add the windows libraries
LIBS += -luser32 -lgdi32 -lddraw -ldsound -ldxguid -lwinmm -ladvapi32 -lcomctl32 -lshlwapi
ifdef CPP_COMPILE
ifndef MSVC_BUILD
LIBS += -lsupc++
endif
endif
LIBS += -luser32 -lgdi32 -lddraw -ldsound -ldxguid -lwinmm -ladvapi32 -lcomctl32 -lshlwapi -ldinput8
ifeq ($(DIRECTINPUT),8)
LIBS += -ldinput8
@ -257,14 +228,6 @@ LIBS += -ldinput
CCOMFLAGS += -DDIRECTINPUT_VERSION=0x0700
endif
ifdef PTR64
ifdef MSVC_BUILD
LIBS += -lbufferoverflowu
else
DEFS += -D_COM_interface=struct
endif
endif
#-------------------------------------------------