.KEEP_STATES:

CFLAGS=-O2
OBJETS= fonctions.o sesh.o seshl.o hache.o

# sesh can work if you build it with lex, but it won't work with 8bits files
# if you do so, because lex is brain dead in this case. So you should try 
# to get a copy of flex, which is much better and is GNU.


LEX=flex -8

# So , IF YOU DON'T HAVE FLEX, uncomment the lines below
#LEX=lex
#LIBR=-ll

#in case you have bison, uncomment the lines below
YACC=bison
YFLAGS=-y -d 


sesh: $(OBJETS)
	$(LINK.c) -o $@ $(OBJETS) $(LIBR)

seshl.o : seshl.c

sesh.c sesh.h: sesh.y
	$(YACC.y) -d sesh.y
	mv y.tab.c sesh.c
	@if cmp -s y.tab.h sesh.h ; then \
		\rm y.tab.h;\
	else\
		echo mv y.tab.h sesh.h;\
		mv y.tab.h sesh.h;\
	fi

seshl.o: sesh.h

fonctions.o : seshSource.h

seshSource.h: seshSource.txt
	/usr/bin/awk -f mklex.awk < seshSource.txt > $@

install:
	install -m 0755 sesh /usr/bin/sesh

clean: 
	/bin/rm *.o seshl.c sesh.c sesh.h seshSource.h










