# building mtn windows 64-bit version on Fedora machine:
#   download and extract
#     FFmpeg (with "shared in filename") from https://github.com/BtbN/FFmpeg-Builds/releases into mtn's lib/windows directory
#     artifact libgd  from https://ci.appveyor.com/project/imazen/gd-libgd into mtn's lib/windows directory
#   install gcc
#     dnf install make mingw64-gcc.x86_64
#   cd src
#   run build
#   > make -f Makefile.mingw
#
#
# mtn's lib directory structure should look like this
#|-- lib
#|   `-- windows
#|       |-- bin
#|       |   |-- avcodec-57.dll
#|       |   |-- avformat-57.dll
#|       |   |-- liblibgd.dll
#|       |   `-- ...
#|       |-- include
#|       |   |-- gd.h
#|       |   |-- gd_io.h
#|       |   |-- gdfx.h
#|       |   |-- libavcodec
#|       |   |   |-- avcodec.h
#|       |   |   |-- avdct.h
#|       |   |   |-- ...
#|       |   |-- libswresample
#|       |   |   |-- swresample.h
#|       |   |   `-- version.h
#|       |   `-- ...
#|       |-- lib
#|       |   |-- avcodec-57.def
#|       |   |-- avcodec.lib
#|       |   |-- avdevice-57.def
#|       |   |-- avdevice.lib
#|       |   |-- ...

CC=x86_64-w64-mingw32-gcc
CFLAGS=-Wall -DWIN32 -O3
OUT=../bin
LDFLAGS=-L../lib/windows/lib
INCLUDE=-I../lib/windows/include
LIBS=-llibgd -lavutil -lavdevice -lavformat -lavfilter -lavcodec  -lswscale -lm

mtn: mtn.c outdir
	$(CC) -o $(OUT)/mtn.exe mtn.c $(CFLAGS) $(LDFLAGS) $(INCLUDE) $(LIBS)

outdir:
	mkdir -p $(OUT)
	
clean:
	rm -f $(OUT)/mtn.exe
