Skip to content

Commit

Permalink
Fixed mingw32 compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
AKuHAK committed Jan 29, 2021
1 parent 46ca19b commit 68e555f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 43 deletions.
17 changes: 8 additions & 9 deletions Makefile.mingw32
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

GCC = i586-mingw32msvc-gcc -Wall
INC = -I ../pthreads-win32
LIB = -lwsock32 -lpthreadGC2 -L ../pthreads-win32
#CC = i686-w64-mingw32.static-gcc -Wall
LIB = -lwsock32 -lpthread

ifeq "x$(PREFIX)" "x"
PREFIX = $(PS2DEV)
Expand All @@ -19,31 +18,31 @@
OFILES += obj/network.o
obj/network.o: src/network.c src/network.h
@mkdir -p obj
$(GCC) $(INC) -c src/network.c -o obj/network.o
$(CC) $(INC) -c src/network.c -o obj/network.o

OFILES += obj/ps2link.o
obj/ps2link.o: src/ps2link.c src/ps2link.h
@mkdir -p obj
$(GCC) $(INC) -c src/ps2link.c -o obj/ps2link.o
$(CC) $(INC) -c src/ps2link.c -o obj/ps2link.o

OFILES += obj/ps2netfs.o
obj/ps2netfs.o: src/ps2netfs.c
@mkdir -p obj
$(GCC) $(INC) -c src/ps2netfs.c -o obj/ps2netfs.o
$(CC) $(INC) -c src/ps2netfs.c -o obj/ps2netfs.o

OFILES += obj/utility.o
obj/utility.o: src/utility.c src/utility.h
@mkdir -p obj
$(GCC) $(INC) -c src/utility.c -o obj/utility.o
$(CC) $(INC) -c src/utility.c -o obj/utility.o

#####################
## CLIENT PROGRAMS ##
#####################

bin/fsclient.exe: $(OFILES) src/fsclient.c
@mkdir -p bin
$(GCC) $(INC) $(OFILES) src/fsclient.c -o bin/fsclient.exe $(LIB)
$(CC) $(INC) $(OFILES) src/fsclient.c -o bin/fsclient.exe $(LIB)

bin/ps2client.exe: $(OFILES) src/ps2client.c
@mkdir -p bin
$(GCC) $(INC) $(OFILES) src/ps2client.c -o bin/ps2client.exe $(LIB)
$(CC) $(INC) $(OFILES) src/ps2client.c -o bin/ps2client.exe $(LIB)
28 changes: 2 additions & 26 deletions doc/readme-mingw32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,5 @@
----------------------------------

Since now, ps2client uses the pthread library to work, you need the
pthreads-win32 native library to compile ps2client using a mingw32
compiler. You want to download the prebuilt binaries and headers
from ftp://sources.redhat.com/pub/pthreads-win32 and put them
in the ../pthreads-win32 directory. You need the following files:

libpthreadGC2.a
pthread.h
pthreadGC2.dll
sched.h
semaphore.h

Note that if you're using a linux host to cross compile, you probably
want to dos2unix *.h before compiling.

------------------
MORE INFORMATION
------------------

If you want to get into the wonderful world of homebrew ps2
development, there's a few places you can check out:

http://www.ps2dev.org - News, tutorials and documentation.

http://forums.ps2dev.org - The official ps2dev forums.

#ps2dev on efnet (IRC) - Come banter in realtime.
threads support. For example you can use MXE/MinGW-w64 with win32
threads.
2 changes: 0 additions & 2 deletions src/fsclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include <unistd.h>
#ifndef _WIN32
#include <netinet/in.h>
#else
#include <windows.h>
#endif
#include "utility.h"
#include "ps2netfs.h"
Expand Down
5 changes: 1 addition & 4 deletions src/network.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@

#ifdef _WIN32
#include <windows.h>
#include <winsock2.h>
#else
#ifndef _WIN32
#include <netdb.h>
#include <unistd.h>
#include <sys/socket.h>
Expand Down
1 change: 1 addition & 0 deletions src/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#else
#include <sys/socket.h>
#endif
Expand Down
2 changes: 0 additions & 2 deletions src/ps2netfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <string.h>
#ifndef _WIN32
#include <netinet/in.h>
#else
#include <windows.h>
#endif
#include "utility.h"
#include "network.h"
Expand Down

0 comments on commit 68e555f

Please sign in to comment.