CC = gcc
CFLAGS = $(GLOBAL_CFLAGS) $(APP_CFLAGS) $(MSYS_CFLAGS) -DT3F_NO_UTF8
CXXFLAGS = $(CFLAGS)
LFLAGS = -static -static-libgcc -static-libstdc++ -mwindows
LIB_SUFFIX = -static
PLATFORM_OBJECTS = t3f/menu.o t3f/windows.o icon.o $(MSYS_PLATFORM_OBJECTS)
PLATFORM_LIBS = -lallegro_dialog$(LIB_SUFFIX) $(MSYS_PLATFORM_LIBS)
DEPEND_LIBS = $(MSYS_DEPEND_LIBS) -luuid -lkernel32 -lwinmm -lpsapi\
              -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 -lshell32 -lole32\
              -ladvapi32 -lws2_32 -lshlwapi -lvorbisfile -lvorbis -lFLAC -logg\
              -ldumb -lfreetype -lpng -lz -ljpeg -ld3d9 -ldsound -lstdc++
DEL_COMMAND = rm -f
DEL_FOLDER_COMMAND = rm -rf
SED_COMMAND = sed -i
EXE_SUFFIX = .exe
COPY_COMMAND = cp
PATH_SEPARATOR = /

include makefile.common

prepare_platform:
	@echo Ready to build...

../icons/windows_icon.ico: ../icons/16.png ../icons/24.png ../icons/32.png ../icons/48.png ../icons/256.png ../win32/makeicon$(EXE_SUFFIX)
	../win32/makeicon -o ../icons/windows_icon.ico ../icons/16.png ../icons/24.png ../icons/32.png ../icons/48.png ../icons/64.png ../icons/256.png

icon.o : ../icons/windows_icon.ico ../win32/icon.rc
	windres --include-dir=../icons -o icon.o ../win32/icon.rc

../win32/info_fixer: ../win32/info_fixer.o
	$(CC) $(GLOBAL_CFLAGS) ../win32/info_fixer.o -o ../win32/info_fixer

windows_zip: $(APP_EXE_NAME)
	@cd ../bin; zip -9 -r $(APP_PACKAGE_DIR)/$(APP_NAME)-$(APP_VERSION)-windows.zip *; cd ../win32/blobs && zip -9 ../$(APP_PACKAGE_DIR)/$(APP_NAME)-$(APP_VERSION)-windows.zip *; cd ../../; cp -a docs win32; cd win32/docs; mv changelog history.txt; mv README readme.txt; mv copyright license.txt; cd ..; zip -9 -r $(APP_PACKAGE_DIR)/$(APP_NAME)-$(APP_VERSION)-windows.zip docs; rm -rf docs
	@echo Windows package created!
