REUSE	= ../reuse
TREEDIR	= ../front
IFLAGS	= -I$(REUSE) -I$(TREEDIR)
CFLAGS	= $(OPT) $(SF) $(IFLAGS)
LDFLAGS = -r -o

BE	= BackEnd.o BEprint.o be_print.o 
PRINT	= Type.o Gen.o IlpTree.o \
	  File_print.o VarDecl_print.o Type_print.o \
	  Expr_print.o Stats_print.o  Prop.o\
	  NetType_print.o VarName.o NetDecl_print.o print_NetCreate.o\
	  GenTree.o Traverse.o Communication.o PredExpr_print.o Assign.o\
	  stack.o ConvertType.o Optim_print.o\
	  ress.o tiling.o ilp.o

OBJS	= $(BE) $(PRINT)

all:	$(OBJS)
	cp $(OBJS) ..

Tree_h =	$(TREEDIR)/Tree.h
TreeBE_h =	$(Tree_h) be_print.h ress.h tiling.h ilp.h
TreeBEGen_h =	$(TreeBE_h) Gen.h Type.h

Gen.o:	Gen.h
Type.o:	Type.h
IlpTree.o:	IlpTree.h


BackEnd.o:	$(TreeBE_h)
BEprint.o:	$(TreeBE_h)
be_print.o:	$(TreeBE_h)

File_print.o:		$(TreeBEGen_h)
VarDecl_print.o: 	$(TreeBEGen_h)
Type_print.o:		$(TreeBE_h)
Expr_print.o:		$(TreeBE_h)
Stats_print.o:		$(TreeBEGen_h)
Prop.o:			$(TreeBEGen_h)
NetType_print.o:	$(TreeBE_h)
VarName.o:		$(TreeBE_h)
NetDecl_print.o:	$(TreeBE_h)
print_NetCreate.o:	$(TreeBEGen_h)
GenTree.o:		$(TreeBEGen_h)
Traverse.o:		$(TreeBE_h)
Communication.o:	$(TreeBE_h)
PredExpr_print.o:	$(TreeBE_h)
Assign.o:		$(TreeBE_h)
stack.o:		$(TreeBE_h)
ConvertType.o:		$(TreeBE_h) 
Optim_print.o:		$(TreeBE_h)
ress.o:			$(TreeBE_h)
tiling.o:		$(TreeBE_h) machdep.h
ilp.o:			$(TreeBE_h) ilp.h

clean:
	rm -f core *.[o] *% *.*%

.SUFFIXES:	.c .o

.c.o:
	$(CC) $(CFLAGS) -c $*.c
