INCLUDES	= -I../libtable -I..
LOCAL_LIBRARIES = ../libtable/libtable.a
LEX		= flex
YACC		= bison -y

SRCS	= class.c \
		grammar.y \
		input.c \
		lex.l \
		lookup.c \
		main.c \
		output.c \
		output_tex.c \
		output_util.c \
		str_util.c \
		var.c
OBJS	= class.o \
		grammar.o \
		input.o \
		main.o \
		lookup.o \
		output.o \
		output_tex.o \
		output_util.o \
		str_util.o \
		var.o \
		lex.o

#include "../Xo.tmpl"

ComplexProgramTarget(build)
lex.o:	lex.c grammar.h
	$(CC) -c $(CFLAGS) $*.c

lex.c: lex.l
	flex lex.l
	@mv lex.yy.c lex.c

grammar.o:	grammar.h grammar.y grammar.c input.h
	$(CC) -c $(CFLAGS) $*.c

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