CXX		= g++
#CXX             = /usr0/local/libexec/gcc-2.95.3/bin/g++
#CXX		= insure
RM = /bin/rm

WD = $(shell pwd)

ifeq ($(strip $(SPADESINST)),)
$(error Need to set the SPADESINST environment variable!)
endif

CXXFLAGS += -Wall -Woverloaded-virtual
ifneq ($(strip $(DEBUGMODE)),)
#we are in debug mode
CXXFLAGS += -g 
else
CXXFLAGS += -O2
CXXFLAGS += -DNO_ACTION_LOG
endif

CXXINCLUDE = -I$(SPADESINST)/include/spades

LDFLAGS = 

#These are for profiling
#CXXFLAGS += -pg
#LDFLAGS += -pg

NORM_OFILES =  ActionSubsetMap.o MDP.o Policy.o QTable.o QTableFlat.o random.o 
NORM_OFILES += SAAdviceRepository.o FIFOLimSAAdviceRepository.o
NORM_SRCS   = $(OFILES:%.o=%.cpp)
OFILES = $(NORM_OFILES)
SRCS   = $(NORM_SRCS)

all: $(OFILES)

full: cln depend all


%.o : %.cpp
	$(CXX) -c $(CXXFLAGS) $(CXXINCLUDE) $<

clean: cln
cln:
	echo cleaning up....
	$(RM) -f $(OFILES)

depend:
	$(RM) -f $(DEPEND)
	$(CXX) -M $(CXXFLAGS) $(CXXINCLUDE) $(SRCS) >> $(DEPEND)

DEPEND = Makefile.depend
ifeq ($(wildcard $(DEPEND)),$(DEPEND))
include $(DEPEND)
endif
