# must have $(TOP) set to install area

CXX = g++
# CDF = 1
# CXX = KCC

ELF_LIB = -L$(HOME)/lib
ELF_INC = -I$(HOME)/include

ifdef CDF
NO_EXCEPT = --no_exceptions
NO_EXCEPT_DEF = -DNO_EXCEPT
endif

# DEB = -DDEBUG_ME

LDFLAGS = -L. $(ELF_LIB) -L/usr/local/lib -L$(TOP)/lib
COM_INCS = $(ELF_INC) -I/usr/local/include -I$(TOP)/include
COM_FLAGS = -g $(NO_EXCEPT_DEF) -DLINUX $(DEB) -D_POSIX_C_SOURCE=199506L $(COM_INCS)

KAI_CXX = KCC
KAI_FLAGS = -D_GNU_SOURCE $(COM_FLAGS) --one_instantiation_per_object $(NO_EXCEPT) -DKAI +K3
KAI_AR = $(KAI_CXX) $(KAI_FLAGS) -o
KAI_COMPILE = $(KAI_CXX) $(KAI_FLAGS)
KAI_LD = $(KAI_CXX)  --one_instantiation_per_object $(LDFLAGS) $(NO_EXCEPT)

GCC_CXX = g++
GCC_FLAGS = $(COM_FLAGS) -O3
GCC_AR = ar r
GCC_COMPILE = $(GCC_CXX) $(GCC_FLAGS)
GCC_LD = $(GCC_CXX) $(LDFLAGS) -shared 

LD_LIB_FLAGS = # -shared

# example
# LDLIBS = -lMemLoggerUtil -lz -lELFIO

ifeq ("$(CXX)","g++")
AR = $(GCC_AR)
CXXFLAGS = $(GCC_FLAGS)
MAKE_LIB = $(GCC_LD)
else
AR = $(KAI_AR)
CXXFLAGS = $(KAI_FLAGS)
MAKE_LIB = $(KAI_LD)
endif