CPP  = g++
CC   = gcc
# WINDRES = windres.exe
RES  =
OBJ  = arkanoid.o ball.o $(RES)
LINKOBJ  = arkanoid.o ball.o $(RES)
LIBS = `pkg-config --libs sdl2` `pkg-config --libs SDL2_ttf`
INCS = `pkg-config --cflags sdl2`
CXXINCS =
BIN  = arkanoid
CXXFLAGS = $(CXXINCS)   -g
CFLAGS = $(INCS)   -g
RM = rm -f
prefix=/usr

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

all: all-before arkanoid all-after


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

$(BIN): $(OBJ)
	$(CC) $(LINKOBJ) -o "arkanoid" $(LIBS)

arkanoid.o: arkanoid.c
	$(CC) -c arkanoid.c -o arkanoid.o $(CFLAGS) -DLINUX

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

install:
	mkdir -pm 0755 $(DESTDIR)$(prefix)/bin
	mkdir -pm 0755 $(DESTDIR)$(prefix)/share/arkanoid
	mkdir -pm 0755 $(DESTDIR)$(prefix)/share/pixmaps
	mkdir -pm 0755 $(DESTDIR)$(prefix)/share/applications
	install -m 0755 arkanoid $(DESTDIR)$(prefix)/bin
	install -m 0644 icon/arkanoid.png $(DESTDIR)$(prefix)/share/pixmaps
	install -m 0644 icon/gumka_arkanoid.bmp $(DESTDIR)$(prefix)/share/pixmaps
	install -m 0755 arkanoid.desktop $(DESTDIR)$(prefix)/share/applications
	install -m 0644 SpicyRice.ttf $(DESTDIR)$(prefix)/share/arkanoid
.PHONY: install

