MINGW_DIR=../MinGW
GPP=wine "${MINGW_DIR}"/bin/mingw32-g++
WINDRES=wine "${MINGW_DIR}"/bin/windres
FLAGS=-O2 -s -static-libgcc -static-libstdc++

all: ../bin ../bin/updatem.exe ../bin/runner.exe ../bin/shellexecute.exe ../bin/lsdeps.exe ../log.exe
	$(MAKE) -f Makefile.wine -C complement
	$(MAKE) -f Makefile.wine -C img_viewer

clean:
	rm -f ../release.w32/xmlres.o ../bin/updatem.exe ../bin/runner.exe ../bin/shellexecute.exe ../bin/lsdeps.exe ../log.exe
	$(MAKE) -f Makefile.wine -C complement clean
	$(MAKE) -f Makefile.wine -C img_viewer clean

../release.w32:
	mkdir ../release.w32

../bin:
	mkdir ../bin

../release.w32/xmlres.o: ../release.w32 manifest.xml xmlres.rc
	${WINDRES} -i xmlres.rc -o $@

../bin/lsdeps.exe: lsdeps.cpp itlib.cpp itlib.h peliberr.cpp peliberr.h stdafx.h
	${GPP} ${FLAGS} -static-libgcc -O2 lsdeps.cpp itlib.cpp peliberr.cpp  -o $@

../bin/runner.exe: runner.cpp
	${GPP} ${FLAGS} runner.cpp -o $@

../bin/shellexecute.exe: shellexecute.cpp
	${GPP} -s -static-libgcc -static-libstdc++ -mwindows shellexecute.cpp -o $@

../bin/updatem.exe: updatem.cpp zockets.cpp zockets.h ../release.w32/xmlres.o
	${GPP} ${FLAGS} -mwindows updatem.cpp zockets.cpp -lwsock32 xmlres.o -o $@

../log.exe: log-w32.cpp
	${GPP} -mwindows -static-libgcc -static-libstdc++ log-32.cpp -o $@
