ifdef RELEASE
	# RELEASE CFLAGS	
	#export CFLAGS := -fmessage-length=0 -O3 -fomit-frame-pointer -pipe -march=pentium-m -msse2 -msse -mmmx
	export CFLAGS := -O2 -fomit-frame-pointer -pipe -march=i686 
	export CXXFLAGS := $(CFLAGS)
	export LDFLAGS := -s
else
	# DEBUG CFLAGS
	export CFLAGS := -g3 -fmessage-length=0 -Wall -DDEBUG -pipe
	export CXXFLAGS := $(CFLAGS)
	export LDFLAGS :=
endif

ifeq ($(MAKE),mingw32-make)
	# Windows
	export OS = WIN32
	export RM = del /F
	export RMSUB = del /F /s /Q
	export EXT = .exe
	export SLASH = \\
	export CC = gcc
	export CP = copy
	export MKDIR = mkdir
else
	# Linux
	export OS = LINUX
	export RM = rm -f
	export RMSUB = rm -Rf
	export EXT =
	export SLASH = /
	export CP = cp
	export MKDIR = mkdir -p
endif

%.o: %.cpp
	@echo Compiling $@ ...
	@$(CXX) -c $(CXXFLAGS) -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o $@ $<

%.o: %.c
	@echo Compiling $@ ...
	@$(CC) -c $(CFLAGS) -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o $@ $<
