diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..000abe7c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +obj/ +src/dep/generated/* +gamelist.txt +fba.exe +fbad.exe diff --git a/makefile.mingw b/makefile.mingw index 5bbb30f00..d6a2772b1 100644 --- a/makefile.mingw +++ b/makefile.mingw @@ -73,6 +73,11 @@ else NAME := $(NAME)$(CPUTYPE) endif +# determine if cross-compiling +HOST = $(shell uname) +ifeq (,$(findstring NT,$(HOST))) + CROSS = 1 +endif # @@ -109,12 +114,15 @@ endif ifdef GCC510 incdir = $(foreach dir,$(alldir),-I$(srcdir)$(dir)) -I$(objdir)dep/generated -I$(srcdir)dep/mingw/include -I$(srcdir)dep/mingw/include/directx9 -I$(srcdir)dep/mingw/include/xaudio2 endif +ifdef CROSS +incdir = $(foreach dir,$(alldir),-I$(srcdir)$(dir)) -I$(objdir)dep/generated -I$(srcdir)dep/mingw/include -I$(srcdir)dep/mingw/include/directx9 -I$(srcdir)dep/mingw/include/xaudio2 +endif ifdef UNICODE # lib = -lunicows endif -lib += -luser32 -lgdi32 -lcomdlg32 -lcomctl32 -lshell32 -lwinmm -lshlwapi -ladvapi32 -lsetupapi -lole32 -luuid -lwininet +lib += -luser32 -lgdi32 -lcomdlg32 -lcomctl32 -lshell32 -lwinmm -lshlwapi -ladvapi32 -lsetupapi -lole32 -luuid -lwininet -ldxguid -lxaudio2_8 ifdef INCLUDE_AVI_RECORDING lib += -lvfw32 @@ -130,6 +138,8 @@ ifdef BUILD_A68K a68k.o = $(objdir)cpu/a68k/a68k.o endif + + app_gnuc.rc = $(srcdir)dep/generated/app_gnuc.rc license.rtf = $(srcdir)dep/generated/license.rtf driverlist.h = $(srcdir)dep/generated/driverlist.h @@ -178,8 +188,16 @@ autdrv := $(drvsrc:.cpp=.o) # # -CC = gcc -CXX = g++ +ifdef CROSS + ifdef BUILD_X64_EXE + PREFIX = x86_64-w64-mingw32- + else + PREFIX = i686-w64-mingw32- + endif +endif + +CC = $(PREFIX)gcc +CXX = $(PREFIX)g++ LD = $(CXX) AS = nasm @@ -293,6 +311,29 @@ else endif endif +ifdef CROSS +CFLAGS = -pipe \ + -std=gnu99 -O1 \ + -mwindows \ + -fforce-addr -finline-limit=1200 -fthread-jumps \ + -fexpensive-optimizations \ + -Wall -Wno-long-long -Wno-sign-compare -Wno-uninitialized -Wno-unused \ + -Wno-sequence-point -Wno-pedantic \ + $(DEF) $(incdir) + +CXXFLAGS = -pipe \ + -std=gnu++11 -O1 \ + -mwindows \ + -fforce-addr -finline-limit=1200 -fthread-jumps \ + -fexpensive-optimizations -fcheck-new \ + -Wall -W -pedantic -Wshadow -Wno-long-long -Wno-write-strings \ + -Wunknown-pragmas -Wundef -Wno-conversion -Wno-missing-braces -Wno-multichar \ + -Wuninitialized -Wpointer-arith -Wno-inline -Wno-address -Wno-unused-value \ + -Wno-unused-but-set-variable -Wno-sequence-point -Wno-narrowing -Wno-extra \ + -Wno-pedantic \ + $(DEF) $(incdir) +endif + ASFLAGS = -O1 -f coff -w-orphan-labels # D3DUtils & D3DMath need these @@ -596,11 +637,12 @@ $(objdir)cpu/m68k/m68kops.o: $(objdir)cpu/m68k/m68kmake.exe $(objdir)dep/generat @$(CC) $(CFLAGS) -c $(objdir)dep/generated/m68kops.c -o $(objdir)cpu/m68k/m68kops.o $(objdir)dep/generated/m68kops.h: $(objdir)cpu/m68k/m68kmake.exe $(srcdir)cpu/m68k/m68k_in.c - $(objdir)/cpu/m68k/m68kmake $(objdir)dep/generated/ $(srcdir)cpu/m68k/m68k_in.c + $(objdir)/cpu/m68k/m68kmake.exe $(objdir)dep/generated/ $(srcdir)cpu/m68k/m68k_in.c $(objdir)cpu/m68k/m68kmake.exe: $(srcdir)cpu/m68k/m68kmake.c @echo Compiling Musashi MC680x0 core \(m68kmake.c\)... - @$(CC) $(CFLAGS) $(srcdir)cpu/m68k/m68kmake.c -o $(objdir)cpu/m68k/m68kmake.exe + # need to build using native cc to allow cross-compilations + @cc $(srcdir)cpu/m68k/m68kmake.c -o $(objdir)cpu/m68k/m68kmake.exe # @@ -687,6 +729,13 @@ endif %.o: %.rc @echo Compiling resource file $( -#include +#include #define DIRECTSOUND_VERSION 0x0300 // Only need version from DirectX 3 #include diff --git a/src/intf/audio/win32/aud_xaudio2.cpp b/src/intf/audio/win32/aud_xaudio2.cpp index a6d534b89..b6f1eb7b1 100644 --- a/src/intf/audio/win32/aud_xaudio2.cpp +++ b/src/intf/audio/win32/aud_xaudio2.cpp @@ -2,7 +2,8 @@ #include "aud_dsp.h" //#ifdef _MSC_VER -#include +#define INITGUID +#include #include #include diff --git a/src/intf/input/win32/inp_dinput.cpp b/src/intf/input/win32/inp_dinput.cpp index 476f32a16..12141a8d8 100644 --- a/src/intf/input/win32/inp_dinput.cpp +++ b/src/intf/input/win32/inp_dinput.cpp @@ -4,7 +4,7 @@ #include "burner.h" #include "inp_keys.h" -#include +#include #define DIRECTINPUT_VERSION 0x0800 #include diff --git a/src/intf/video/win32/vid_d3d.cpp b/src/intf/video/win32/vid_d3d.cpp index b92e6547a..dd033b889 100644 --- a/src/intf/video/win32/vid_d3d.cpp +++ b/src/intf/video/win32/vid_d3d.cpp @@ -7,7 +7,7 @@ #if !defined BUILD_X64_EXE // #include "vid_directx_support.h" -#include +#include #include "vid_softfx.h" // #define ENABLE_PROFILING FBA_DEBUG diff --git a/src/intf/video/win32/vid_ddraw.cpp b/src/intf/video/win32/vid_ddraw.cpp index cd60700d2..11c3e68b6 100644 --- a/src/intf/video/win32/vid_ddraw.cpp +++ b/src/intf/video/win32/vid_ddraw.cpp @@ -6,7 +6,7 @@ #include "vid_directx_support.h" #endif -#include +#include #define DIRECT3D_VERSION 0x0700 // Use this Direct3D version #if defined BUILD_X64_EXE diff --git a/src/intf/video/win32/vid_ddrawfx.cpp b/src/intf/video/win32/vid_ddrawfx.cpp index 230e85eab..d720cc1b7 100644 --- a/src/intf/video/win32/vid_ddrawfx.cpp +++ b/src/intf/video/win32/vid_ddrawfx.cpp @@ -6,7 +6,7 @@ #include "vid_softfx.h" #endif -#include +#include #define DIRECT3D_VERSION 0x0700 // Use this Direct3D version #if defined BUILD_X64_EXE diff --git a/src/intf/video/win32/vid_directx9.cpp b/src/intf/video/win32/vid_directx9.cpp index 27a28e51c..575753a76 100644 --- a/src/intf/video/win32/vid_directx9.cpp +++ b/src/intf/video/win32/vid_directx9.cpp @@ -10,7 +10,7 @@ // #define ENABLE_PROFILING FBA_DEBUG // #define LOAD_EFFECT_FROM_FILE -#include +#include #define DIRECT3D_VERSION 0x0900 // Use this Direct3D version #define D3D_OVERLOADS #include diff --git a/src/intf/video/win32/vid_directx_support.cpp b/src/intf/video/win32/vid_directx_support.cpp index b2842b8ae..e02cd5473 100644 --- a/src/intf/video/win32/vid_directx_support.cpp +++ b/src/intf/video/win32/vid_directx_support.cpp @@ -5,7 +5,7 @@ #include "vid_directx_support.h" #endif -#include +#include #define DIRECT3D_VERSION 0x0700 // Use this Direct3D version #if defined BUILD_X64_EXE