diff --git a/makefile b/makefile index 30e9b61708d..71bfff923af 100644 --- a/makefile +++ b/makefile @@ -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 diff --git a/src/emu/cpu/arm7/arm7core.c b/src/emu/cpu/arm7/arm7core.c index 2a05d01541c..bf2b403db5e 100644 --- a/src/emu/cpu/arm7/arm7core.c +++ b/src/emu/cpu/arm7/arm7core.c @@ -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; diff --git a/src/emu/cpu/drcbec.c b/src/emu/cpu/drcbec.c index 4c62f297178..73a05902c15 100644 --- a/src/emu/cpu/drcbec.c +++ b/src/emu/cpu/drcbec.c @@ -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, diff --git a/src/emu/cpu/drcbex64.c b/src/emu/cpu/drcbex64.c index 5dd6e478bf7..463a38110c5 100644 --- a/src/emu/cpu/drcbex64.c +++ b/src/emu/cpu/drcbex64.c @@ -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, diff --git a/src/emu/cpu/drcbex86.c b/src/emu/cpu/drcbex86.c index dac3280bb19..f97b5c640c0 100644 --- a/src/emu/cpu/drcbex86.c +++ b/src/emu/cpu/drcbex86.c @@ -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, diff --git a/src/emu/cpu/superfx/superfx.c b/src/emu/cpu/superfx/superfx.c index 5959902ab78..b72dc72a369 100644 --- a/src/emu/cpu/superfx/superfx.c +++ b/src/emu/cpu/superfx/superfx.c @@ -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; diff --git a/src/emu/driver.h b/src/emu/driver.h index 41744efdd87..88fa88fbb68 100644 --- a/src/emu/driver.h +++ b/src/emu/driver.h @@ -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, \ diff --git a/src/osd/windows/input.c b/src/osd/windows/input.c index f3649fcf0f3..47f7a96f800 100644 --- a/src/osd/windows/input.c +++ b/src/osd/windows/input.c @@ -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; diff --git a/src/osd/windows/main.c b/src/osd/windows/main.c index 01b9a6fe3d3..729b99b8316 100644 --- a/src/osd/windows/main.c +++ b/src/osd/windows/main.c @@ -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; diff --git a/src/osd/windows/windows.mak b/src/osd/windows/windows.mak index 483dee3597f..f830ba69c71 100644 --- a/src/osd/windows/windows.mak +++ b/src/osd/windows/windows.mak @@ -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 - #-------------------------------------------------