BISON = bison
LEX   = flex


#DEFINES=-DYYDEBUG=1 -DYYERROR_VERBOSE -DYYPURE -DTESTING
CFLAGS=-O2 -Wall
#CFLAGS= -Wall
CFLAGS+=-DYYPURE

CFILES = parser.c lexer.c
LFILES = lexer.l
YFILES = parser.y
HFILES = 

%.o:     %.c
	$(CC) -c $(CFLAGS) $(DEFINES) -o $@ $<

# All object-files are included here.

all: parser

parser: parser.o lexer.o
	$(CC) -o parser parser.o lexer.o

parser.o: parser.c parser.h parserd.h Makefile
	$(CC) -c $(CFLAGS) $(DEFINES) -o parser.o parser.c
 
parser.c parser.h: parser.y parserd.h
	$(BISON) -do $@  $<

lexer.c : lexer.l parser.y parser.h parserd.h
	$(LEX) -i -t >lexer.c $< 

clean::
	-rm -f *.o parser parser.c parser.h lexer.c .depend *~

takeover::
	cp -f parser.[cyh] parserd.h lexer.[cl]  test.txt /C/suse/setup

.depend dep:  
	$(CC) -MM $(CFLAGS) $(CFILES) > .depend

#
# include a dependency file if one exists
#
#ifeq (.depend,$(wildcard .depend))
#include .depend
#endif

