
WRAPPERDIR := $(CURDIR)
BASEDIR = $(CURDIR)/..

CC = gcc

CFLAGS = -g -D__SDL_WRAPPER__

ifeq (x86_64,$(shell uname -m))
BASELIBDIR := lib64
CFLAGS += -m64
LFLAGS += -m64
else
BASELIBDIR := lib
CFLAGS += -m32
LFLAGS += -m32
endif
CFLAGS += -g $(shell PKG_CONFIG_PATH=/usr/$(BASELIBDIR)/pkgconfig pkg-config sdl --cflags) $(shell PKG_CONFIG_PATH=/usr/$(BASELIBDIR)/pkgconfig pkg-config gtk+-2.0 --cflags)
LFLAGS += -lm -L/usr/$(BASELIBDIR) $(shell PKG_CONFIG_PATH=/usr/$(BASELIBDIR)/pkgconfig pkg-config sdl --libs) $(shell PKG_CONFIG_PATH=/usr/$(BASELIBDIR)/pkgconfig pkg-config gtk+-2.0 --libs) -lSDL_image -lSDL_ttf -lfreetype -lz -lX11


CFLAGS += -I$(BASEDIR) \
          -I$(WRAPPERDIR) \
          -Ic:/mingw/include/SDL

TARGET = hivelytracker

OBJECTS = sdl_wrapper.o \
          ht.o \
	  linux.o \
	  ../gui.o \
	  ../replay.o \
	  ../util.o \
	  ../undo.o \
	  ../about.o

all: $(TARGET)

-include $(OBJECTS:.o=.d)

$(TARGET): $(OBJECTS)
	$(CC) -o $(TARGET) $(OBJECTS) $(LFLAGS)

$(OBJECTS): %.o: %.c
	$(CC) -c $(CFLAGS) $< -o $@
	@$(CC) -MM $(CFLAGS) $< > $*.d

clean:
	rm $(OBJECTS) $(OBJECTS:.o=.d) $(TARGET)

