RM			= rm -f

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

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

LIB			= -lsoclib -lbfd -liberty 

CXX			= g++
CXX_OPT			= -g3 -Wall -Werror -ansi $(INCDIR)       
LXX_OPT			= $(LIBDIR) $(LIB)

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

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

%.x			: %.cpp $(HEADERS)
			$(CXX) $(CXX_OPT) -o $@ $<  $(LXX_OPT) 
#			$(CXX) $(CXX_OPT) -c -o $@.o $<
#			$(CXX)               -o $@   $@.o $(LXX_OPT)

clean			:
			$(RM) $(EXE) *~ *.o
