]> Shamusworld >> Repos - virtualjaguar/commitdiff
Added bits & pieces to allow cross compilation under MXE.
authorShamus Hammons <jlhamm@acm.org>
Thu, 24 May 2012 22:47:12 +0000 (22:47 +0000)
committerShamus Hammons <jlhamm@acm.org>
Thu, 24 May 2012 22:47:12 +0000 (22:47 +0000)
Makefile
cross-compile [new file with mode: 0755]
jaguarcore.mak
src/m68000/Makefile
virtualjaguar.pro

index 4dfadf4b2321e3e8e3f7f7782a71e8bddd747d1c..a406f12d915e2a7f9bf45b407a10b45400acb67a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,10 @@
 
 FIND = find
 
+# For cross-compilation with MXE
+# We use a script to do this now...
+#CROSS = i686-pc-mingw32-
+
 # Gah
 OSTYPE := $(shell uname -a)
 
@@ -47,11 +51,11 @@ prepare: obj
 
 virtualjaguar: sources libs makefile-qt
        @echo -e "\033[01;33m***\033[00;32m Making Virtual Jaguar GUI...\033[00m"
-       $(MAKE) -f makefile-qt
+       $(MAKE) -f makefile-qt CROSS=$(CROSS)
 
 makefile-qt: virtualjaguar.pro
        @echo -e "\033[01;33m***\033[00;32m Creating Qt makefile...\033[00m"
-       qmake $(QMAKE_EXTRA) virtualjaguar.pro -o makefile-qt
+       $(CROSS)qmake $(QMAKE_EXTRA) virtualjaguar.pro -o makefile-qt
 
 #libs: obj/libmusashi.a obj/libjaguarcore.a
 libs: obj/libm68k.a obj/libjaguarcore.a
@@ -60,7 +64,7 @@ libs: obj/libm68k.a obj/libjaguarcore.a
 obj/libm68k.a: src/m68000/Makefile sources
        @echo -e "\033[01;33m***\033[00;32m Making Customized UAE 68K Core...\033[00m"
 #      @$(MAKE) -C src/m68000
-       @$(MAKE) -C src/m68000 CFLAGS="$(CFLAGS)"
+       @$(MAKE) -C src/m68000 CROSS=$(CROSS) CFLAGS="$(CFLAGS)"
        @cp src/m68000/obj/libm68k.a obj/
 
 obj/libmusashi.a: musashi.mak sources
@@ -70,7 +74,7 @@ obj/libmusashi.a: musashi.mak sources
 obj/libjaguarcore.a: jaguarcore.mak sources
        @echo -e "\033[01;33m***\033[00;32m Making Virtual Jaguar core...\033[00m"
 #      $(MAKE) -f jaguarcore.mak
-       $(MAKE) -f jaguarcore.mak CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)"
+       $(MAKE) -f jaguarcore.mak CROSS=$(CROSS) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)"
 
 sources: src/*.h src/*.cpp src/*.c src/m68000/*.c src/m68000/*.h
 
diff --git a/cross-compile b/cross-compile
new file mode 100755 (executable)
index 0000000..e622a4b
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# Short script to do cross compilation with MXE on Linux
+#
+# by James Hammons
+# (C) 2012 Underground Software
+#
+echo "Cross compiling for Win32..."
+export PATH=/opt/mxe/usr/bin:$PATH
+rm makefile-qt
+make CROSS=i686-pc-mingw32-
index 1bcafe0e1baec2b0737fcc46d5a3839dc852a263..89faa3bad1e42c1779da55d6a5a3520772aaf89a 100644 (file)
@@ -7,8 +7,12 @@
 # file GPLv3 for details. ;-)
 #
 
+# Cross compilation with MXE
+#CROSS = i686-pc-mingw32-
+
 # Figure out which system we're compiling for, and set the appropriate variables
 
+ifeq "$(CROSS)" ""
 OSTYPE := $(shell uname -a)
 
 # Win32
@@ -34,6 +38,10 @@ else
 
 $(error OS TYPE UNDETECTED)
 
+endif
+else
+SYSTYPE    := __GCCWIN32__
+SDLLIBTYPE := --libs
 endif
 
 # Set vars for libcdio
@@ -45,10 +53,10 @@ HAVECDIO :=
 CDIOLIB  :=
 endif
 
-CC       := gcc
-LD       := gcc
-AR       := ar
-ARFLAGS  := -rs
+CC      := $(CROSS)gcc
+LD      := $(CROSS)gcc
+AR      := $(CROSS)ar
+ARFLAGS := -rs
 
 # Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2
 #CFLAGS  := -MMD -O2 -ffast-math -fomit-frame-pointer `sdl-config --cflags` -D$(SYSTYPE)
@@ -56,7 +64,7 @@ ARFLAGS  := -rs
 CFLAGS ?= -O2 -ffast-math -fomit-frame-pointer
 CXXFLAGS ?= -O2 -ffast-math -fomit-frame-pointer
 
-SDL_CFLAGS = `sdl-config --cflags`
+SDL_CFLAGS = `$(CROSS)sdl-config --cflags`
 DEFINES = -D$(SYSTYPE)
 GCC_DEPS = "-MMD"
 
index eac45ba7e25885ac18a9c4e22c8395b8153f77d3..430943b951222ff9a3e6f212449ed269ca46bea7 100644 (file)
@@ -7,9 +7,12 @@
 # This makefile is released under the GPLv3 or later
 #
 
-CC      := gcc
-LD      := gcc
-AR      := ar
+# Cross compilation using MXE
+#CROSS = i686-pc-mingw32-
+
+CC      := $(CROSS)gcc
+LD      := $(CROSS)gcc
+AR      := $(CROSS)ar
 ARFLAGS := -rs
 
 # Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2
@@ -35,7 +38,7 @@ all: obj obj/libm68k.a
        @echo "Done!"
 
 # Library rules (might not be cross-platform compatible)
-obj/libm68k.a: $(OBJS) 
+obj/libm68k.a: $(OBJS)
        @$(AR) $(ARFLAGS) obj/libm68k.a $(OBJS)
 
 obj:
@@ -62,8 +65,8 @@ obj/cpustbl.c: obj/gencpu
 
 obj/gencpu: obj/cpudefs.c
        @echo -e "\033[01;33m***\033[00;32m Generating gencpu...\033[00m"
-#      @$(CC) $(CFLAGS) gencpu.c readcpu.c obj/cpudefs.c -o obj/gencpu -I. -I./obj
-       @$(CC) $(GCC_DEPS) $(CFLAGS) gencpu.c readcpu.c obj/cpudefs.c -o obj/gencpu -I. -I./obj
+#      @$(CC) $(GCC_DEPS) $(CFLAGS) gencpu.c readcpu.c obj/cpudefs.c -o obj/gencpu -I. -I./obj
+       @gcc $(GCC_DEPS) $(CFLAGS) gencpu.c readcpu.c obj/cpudefs.c -o obj/gencpu -I. -I./obj
 
 obj/cpudefs.c: obj/build68k
        @echo -e "\033[01;33m***\033[00;32m Generating cpudefs.c...\033[00m"
@@ -71,8 +74,8 @@ obj/cpudefs.c: obj/build68k
 
 obj/build68k: build68k.c
        @echo -e "\033[01;33m***\033[00;32m Compiling build68k.c...\033[00m"
-#      @$(CC) $(CFLAGS) build68k.c -o obj/build68k
-       @$(CC) $(GCC_DEPS) $(CFLAGS) build68k.c -o obj/build68k
+#      @$(CC) $(GCC_DEPS) $(CFLAGS) build68k.c -o obj/build68k
+       @gcc $(GCC_DEPS) $(CFLAGS) build68k.c -o obj/build68k
 
 clean:
        @echo -ne "\033[01;33m***\033[00;32m Cleaning out the garbage...\033[00m"
index 11f5d6ff435d99745b77a8467df23e734f0a71c4..27959de7e5c5701eb40b6feb4e77048ff2935cf6 100644 (file)
 #
 
 TARGET     = virtualjaguar
-CONFIG    += qt warn_on release debug
+CONFIG    += qt warn_on release
+# debug
 RESOURCES += virtualjaguar.qrc
 #LIBS      += -Lobj -ljaguarcore -lz -lmusashi
 LIBS      += -Lobj -ljaguarcore -lz -lm68k
 QT        += opengl
+#CROSS      = i686-pc-mingw32-
 
 # We stuff all the intermediate crap into obj/ so it won't confuse us mere mortals ;-)
 OBJECTS_DIR = obj
@@ -32,13 +34,16 @@ else:unix { DEFINES += __GCCUNIX__ }
 
 # SDL (to link statically on Mac)
 macx { LIBS += `sdl-config --static-libs` }
-else { LIBS += `sdl-config --libs` }
+else { LIBS += `$(CROSS)sdl-config --libs` }
+
+# Icon on Win32
+win32 { LIBS += res/vj-ico.o }
 
 # C/C++ flags...
 # NOTE: May have to put -Wall back in, but only on non-release cycles. It can
 #       cause problems if you're not careful. (Can do this via command line in qmake)
-QMAKE_CFLAGS += `sdl-config --cflags` -O2 -ffast-math -fomit-frame-pointer
-QMAKE_CXXFLAGS += `sdl-config --cflags` -O2 -ffast-math -fomit-frame-pointer
+QMAKE_CFLAGS += `$(CROSS)sdl-config --cflags` -O2 -ffast-math -fomit-frame-pointer
+QMAKE_CXXFLAGS += `$(CROSS)sdl-config --cflags` -O2 -ffast-math -fomit-frame-pointer
 
 # Need to add libcdio stuffola (checking/including)...