ALLIANCE_INCLUDE = /labo/include
ALLIANCE_LIB = /labo/lib
CC = cc -g -I$(ALLIANCE_INCLUDE)

#DD = -DDEBUG
#DS = -DSTRUCT

genpat : mem.o hash.o libpat_l.o comment.o conv.o label.o action.o affect.o init.o def_gen.o sav_gen.o y.tab.o lex.yy.o genpat.o port.o signal.o register.o array.o
	cc $(DD) $(DS) -g -o genpat array.o register.o signal.o port.o genpat.o y.tab.o lex.yy.o mem.o hash.o libpat_l.o  def_gen.o sav_gen.o init.o affect.o action.o label.o conv.o comment.o -L$(ALLIANCE_LIB) -lPat103 -lPhl103 -lPpt103 -lMut309
	mv genpat ../bin


distrib : mem.o hash.o libpat_l.o comment.o conv.o label.o action.o affect.o init.o def_gen.o sav_gen.o y.tab.o lex.yy.o genpat.o port.o signal.o register.o array.o
	cc $(DD) $(DS) -g -o ../bin/genpat array.o register.o signal.o port.o genpat.o y.tab.o lex.yy.o mem.o hash.o libpat_l.o  def_gen.o sav_gen.o init.o affect.o action.o label.o conv.o comment.o -L$(ALLIANCE_LIB) -lPat103 -lPhl103 -lPpt103 -lMut309

lex.yy.o : y.tab.h lex.yy.c
	$(CC) $(DD) $(DS) -c lex.yy.c

lex.yy.c : genpat.lex genpat.yac
	lex genpat.lex

y.tab.o : mem.h hash.h libpat_l.h  def_gen.h sav_gen.h genpat.h y.tab.c 
	$(CC)  $(DD) $(DS) -c y.tab.c 

y.tab.c : genpat.h genpat.yac
	yacc -v -d genpat.yac

array.o : mem.h hash.h libpat_l.h  genpat.h array.h array.c
	$(CC)  $(DD) $(DS) -c array.c  

register.o : mem.h hash.h libpat_l.h  genpat.h register.h register.c
	$(CC)  $(DD) $(DS) -c register.c  

signal.o : mem.h hash.h libpat_l.h  genpat.h signal.h signal.c
	$(CC)  $(DD) $(DS) -c signal.c  

port.o : mem.h hash.h libpat_l.h  genpat.h port.h port.c
	$(CC)  $(DD) $(DS) -c port.c  

genpat.o : mem.h hash.h libpat_l.h conv.h comment.h label.h action.h init.h affect.h genpat.h genpat.c
	$(CC)  $(DD) $(DS) -c genpat.c  

def_gen.o : mem.h hash.h libpat_l.h def_gen.h def_gen.c
	$(CC)  $(DD) $(DS) -c def_gen.c

sav_gen.o : mem.h hash.h libpat_l.h sav_gen.h sav_gen.c 
	$(CC)  $(DD) $(DS) -c sav_gen.c 

init.o : conv.h action.h libpat_l.h init.h init.c 
	$(CC)  $(DD) $(DS) -c init.c 

affect.o : mem.h hash.h libpat_l.h affect.h affect.c 
	$(CC)  $(DD) $(DS) -c affect.c 

action.o : libpat_l.h action.h action.c
	$(CC)  $(DD) $(DS) -c action.c

label.o : libpat_l.h label.h label.c
	$(CC)  $(DD) $(DS) -c label.c

conv.o : libpat_l.h conv.h conv.c
	$(CC)  $(DD) $(DS) -c conv.c

comment.o : libpat_l.h comment.h comment.c
	$(CC)  $(DD) $(DS) -c comment.c

libpat_l.o : mem.h hash.h libpat_l.h  
	$(CC)  $(DD) $(DS) -c libpat_l.c

hash.o : mem.h hash.h hash.c
	$(CC)  $(DD) $(DS) -c hash.c

mem.o : mem.h mem.c
	$(CC)  $(DD) $(DS) -c mem.c 

clean :
	-rm -f genpat lex* y* *.o 
