CPP  = g++.exe
CC   = gcc.exe

WINDRES = windres.exe
RES  = 
OBJ  =  arkanoid.o ball.o $(RES)
LINKOBJ  = arkanoid.o ball.o $(RES)
#LIBS =  -L"/lib" -lsdl -lsdl_ttf -mwindows
LIBS =  -L"C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\i686-w64-mingw32\pietraszczyk\lib" -mwindows -lmingw32 -lSDL2main -lSDL2 -lSDL2_ttf -static-libgcc
#LIBS = -L"C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\i686-w64-mingw32\pietraszczyk\lib" -Wl,-Bstatic -l:libSDL2_ttf.a  -l:libfreetype.a  -l:libz.a -l:libSDL2main.a -l:libSDL2.a -Wl,-Bdynamic
# # `pkg-config brotlidec --libs` `pkg-config brotlicommon --libs`
#LIBS = -mwindows -Wl,-Bstatic -l:libmingw32.a -l:libgcc.a -l:libgcc_eh.a `sdl2-config --static-libs` `pkg-config sdl2_ttf --static --libs` `pkg-config freetype2 --static --libs` `pkg-config libpng16 --static --libs` `pkg-config zlib --static --libs` `pkg-config libpng --static --libs` `pkg-config harfbuzz --static --libs` `pkg-config graphite2 --static --libs` -l:libstdc++.a -Wl,-Bdynamic
INCS = `sdl2-config --cflags`
INCS = -I"C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\i686-w64-mingw32\pietraszczyk\include" -Dmain=SDL_main
CXXINCS =
BIN  = arkanoid.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS) -g 
RM = rm

.PHONY: all all-before all-after clean clean-custom

all: all-before arkanoid.exe all-after
#all: arkanoid.res arkanoid.exe 


clean: clean-custom
	${RM} $(OBJ)
	${RM} $(BIN)

#arkanoid.res: arkanoid.rc
#	$(WINDRES)  arkanoid.rc arkanoid.res


$(BIN): $(OBJ)
	$(WINDRES) arkanoid.rc -O coff -o icon.o
	$(CC) $(LINKOBJ) -o "arkanoid.exe" $(LIBS) icon.o
#	$(CC) $(LINKOBJ) -o "arkanoid.exe" $(LIBS)

arkanoid.o: arkanoid.c
	$(CC) -c arkanoid.c -o arkanoid.o $(CFLAGS) -DWINDOWS -DNO_STDIO_REDIRECT

ball.o: ball.c
	$(CC) -c ball.c -o ball.o $(CFLAGS) -DNO_STDIO_REDIRECT
