RM			= rm -f

INCDIR			= -I. -I.. 				\
			  -I$(IPS)  				\
			  -I$(TOOLS)/systemc/include		\
			  -I$(TOOLS)/soclib/include

LIBDIR			= -L. -L.. 				\
			  -L$(TOOLS)/or1k/lib 			\
			  -L$(TOOLS)/soclib/lib-$(TARGET_ARCH)	\
			  -L$(TOOLS)/systemc/lib-$(TARGET_ARCH)

LIBS			= -lm -lsystemc -lsoclib -lbfd -liberty -ldl

#DEBUG			= -DDEBUG

CXX			= g++
CXX_OPT			= -g3 -Wall $(INCDIR) $(LIBDIR) $(DEBUG)
CXXFILT			= c++filt

EXE			= $(patsubst %.cpp,%.x ,$(wildcard *.cpp) )
HEADERS			= $(wildcard *.h)

all			: $(EXE)
			./$(EXE)

%.x			: %.cpp $(HEADERS)
			$(CXX) $(CXX_OPT) -o $@ $<  $(LIBS) 2>&1 | $(CXXFILT)
#(TOOLS)/soclib/lib/loadexec.o

clean			:
			$(RM) $(EXE) *~ tty_*
