CC = gcc
CFLAGS = $(GLOBAL_CFLAGS) -DALLEGRO_STATICLINK -DT3F_NO_UTF8 $(APP_CFLAGS) $(MINGW_CFLAGS)
CXXFLAGS = $(CFLAGS)
LFLAGS = -static -static-libgcc -static-libstdc++ -mwindows
LIB_SUFFIX = -static
PLATFORM_OBJECTS = t3f/menu.o t3f/windows.o icon.o $(MINGW_PLATFORM_OBJECTS)
PLATFORM_LIBS = -lallegro_dialog$(LIB_SUFFIX) $(MINGW_PLATFORM_LIBS)
DEPEND_LIBS = $(MINGW_DEPEND_LIBS) -luuid -lkernel32 -lwinmm -lpsapi\
              -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 -lgdiplus -lshell32 -lole32\
              -ladvapi32 -lws2_32 -lshlwapi -lFLAC -lvorbisfile -lvorbis -logg -ldumb\
              -lfreetype -lpng -lz -ljpeg -ld3d9 -ldsound -lstdc++
DEL_COMMAND = del /q
DEL_FOLDER_COMMAND = rmdir /q
COPY_COMMAND = copy /A
SED_COMMAND = echo
PATH_SEPARATOR = $(subst q,\,q)

include makefile.common

prepare_platform:
	@chcp 65001
	@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

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 ../.. && md win32\\docs && xcopy docs win32\\docs /E && cd win32/docs && rename changelog history.txt && rename README readme.txt && rename copyright license.txt && cd .. && zip -9 -r $(APP_PACKAGE_DIR)/$(APP_NAME)-$(APP_VERSION)-windows.zip docs && rmdir /S /Q docs
	@echo Windows package created!
