ifeq ($(OS),Windows_NT)
        OS = Windows
        MICROGLUT = MicroGlut.c
else ifeq ($(shell uname),Linux)
        OS = Linux
        MICROGLUT = MicroGlut.c
else ifeq ($(shell uname),Darwin)
        OS = Mac
        MICROGLUT = MicroGlut.m
endif

COMMON = \
	common/GL_utilities.c \
	common/LoadTGA.c \
	common/$(OS)/$(MICROGLUT)
CPPFLAGS += \
	-Icommon \
	-Icommon/$(OS) \
	-DGL_GLEXT_PROTOTYPES
CXXFLAGS += \
	-Wall
LDLIBS_Windows += \
	-lopengl32
LDLIBS_Linux += \
	-lX11 \
	-lGL
LDLIBS_Mac += \
	-framework Cocoa \
	-framework OpenGL
LDLIBS += \
	$(LDLIBS_$(OS)) \
	-lm \
	-lstdc++

tsbk07: tsbk07.cpp $(COMMON)
	gcc $(CXXFLAGS) -o tsbk07 $(CPPFLAGS) tsbk07.cpp $(COMMON) $(LDLIBS)

clean:
	rm tsbk07