# Makefile for various utilities
# subdir etc

include ../Makefile.inc
TARGETS =	modecc
PARSERSOURCES = modelex.c modepar.tab.c modepar.tab.h

all:		$(TARGETS)

clean:
		rm -f  *.o *.i *.s *~ *.list

realclean:	clean
		rm -f .depend $(TARGETS) $(PARSERSOURCES)

modelex.c:	modelex.l
# Use this one if your (f)lex supports it.
		$(LEX) -B -s -i -omodelex.c modelex.l
#		$(LEX) -s -i -omodelex.c modelex.l
# If your (f)lex doesn't support -o remove -omodlex.c and uncomment the next line
# 		mv lex.yy.c modelex.c

# The automatically generated code may not pass my strict syntaxchecks, then use these:
modelex.o:	modelex.c modepar.tab.h
#		cc $(COPTFLAGS) $(INCLUDES) -o modelex.o -c modelex.c
#modepar.tab.o:	modepar.tab.c
#		cc $(COPTFLAGS) $(INCLUDES) -c modepar.tab.c

.comment:	modelex.o
		@echo
		@echo 'Ignore warning "yyunput defined but not used" when compiling modelex.c.'
		@echo
		@touch .comment

modepar.tab.c:	modepar.y
		$(YACC) -d -bmodepar modepar.y

modepar.tab.h:  modepar.y
		$(YACC) -d -bmodepar modepar.y

modecc:		modecc.o .comment modepar.tab.o
		cc -s -o modecc modecc.o modelex.o modepar.tab.o $(LEXLIB)

dep depend: .depend

.depend:
		$(CC) -E -M $(CFLAGS) *.c > .depend

include .depend
