
 GCC = i586-mingw32msvc-gcc -Wall
 INC = -I ../pthreads-win32
 LIB = -lwsock32 -lpthreadGC2 -L ../pthreads-win32

 ifeq "x$(PREFIX)" "x"
  PREFIX = $(PS2DEV)
 endif

 all: bin/fsclient.exe bin/ps2client.exe

 clean:
	rm -f obj/*.o bin/*client*

 #################
 ## CLIENT LIBS ##
 #################

 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

 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

 OFILES += obj/ps2netfs.o
 obj/ps2netfs.o: src/ps2netfs.c
	@mkdir -p obj
	$(GCC) $(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

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

 bin/fsclient.exe: $(OFILES) src/fsclient.c
	@mkdir -p bin
	$(GCC) $(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)
