changeset 533:52c56ada3816

Fix Win32/MinGW cross-compilation target to work with Debian's gcc-mingw-w64 package, thus upgrading to a new version of MinGW and GCC. Yay.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 07 Jun 2012 03:16:39 +0300
parents cfab338d3c9e
children b1bb64e2e776
files Makefile Makefile.gen Makefile.w32 main.c network.h
diffstat 5 files changed, 13 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Jun 06 18:55:17 2012 +0300
+++ b/Makefile	Thu Jun 07 03:16:39 2012 +0300
@@ -5,6 +5,9 @@
 
 # C-compiler, flags and linker flags
 CC=gcc
+AR=ar
+RANLIB=ranlib
+
 CFLAGS=-DHAVE_STRING_H -DHAVE_STDINT_H
 LDFLAGS=-lncurses
 
--- a/Makefile.gen	Wed Jun 06 18:55:17 2012 +0300
+++ b/Makefile.gen	Thu Jun 07 03:16:39 2012 +0300
@@ -39,6 +39,7 @@
 
 $(THLIBS_A): $(addprefix $(OBJPATH),$(THLIBS_OBJ))
 	$(AR) cru $@ $+
+	$(RANLIB) $@
 
 main.c: VERSION
 
--- a/Makefile.w32	Wed Jun 06 18:55:17 2012 +0300
+++ b/Makefile.w32	Thu Jun 07 03:16:39 2012 +0300
@@ -1,30 +1,19 @@
 #
 # For win32 version cross-compilation with MinGW suite @ Linux
 #
-SDL=y
-
-# Set PATH to include MinGW cross compiler path FIRST!
-PATH=/usr/local/i386-mingw32/bin:/usr/bin:/bin:/usr/local/bin
 
 # C-compiler, flags and linker flags
-CC=gcc
-CFLAGS=-DHAVE_STRING_H -Ipdcurses -mwindows
-
-# Library path must be defined correctly here
-LDFLAGS=-L/usr/local/i386-mingw32/lib/ -liberty -lws2_32 -lole32 -s -mwindows
+CC=i686-w64-mingw32-gcc
+AR=i686-w64-mingw32-ar
+RANLIB=i686-w64-mingw32-ranlib
 
-# Link PDCurses static library here .. you will want to change this
-ifeq ($(SDL),y)
-LDFLAGS+=pdcurses/libpdcurses-sdl.a -lSDL
-else
-LDFLAGS+=pdcurses/libpdcurses.a
-endif
+CFLAGS=-DHAVE_STRING_H -Ipdcurses -mwindows
+LDFLAGS= -lws2_32 -lole32 -mwindows pdcurses/libpdcurses.a -lSDL -s
 
 # Miscellaneous
 EXEEXT=.exe
 OBJPATH=./win32/
 BINPATH=./installer/
-#BINPATH=/misc/wine_c/
 NONBUILD=$(OBJPATH)
 
 EXTRAOBJS= resource.o
--- a/main.c	Wed Jun 06 18:55:17 2012 +0300
+++ b/main.c	Thu Jun 07 03:16:39 2012 +0300
@@ -12,6 +12,9 @@
 #include <errno.h>
 #ifdef __WIN32
 #include <shlwapi.h>
+#include <shfolder.h>
+#define srandom srand
+#define random rand
 #else
 #include <sys/wait.h>
 #endif
--- a/network.h	Wed Jun 06 18:55:17 2012 +0300
+++ b/network.h	Thu Jun 07 03:16:39 2012 +0300
@@ -12,6 +12,7 @@
 #include "th_string.h"
 
 #ifdef __WIN32
+#define __OBJC__ // A nasty hack
 #include <windows.h>
 #include <winsock.h>
 typedef uint16_t in_port_t;