BINDIR=$(ATHETCDIR)

SRCS= synctree.c rules.c glob_match.c bool_exp.c vtable.c err.c \
	util.c glob_match.c regexp.c
OBJS= synctree.o rules.o glob_match.o bool_exp.o vtable.o err.o \
	util.o y.tab.o version.o

#ifdef ibm032
CCDEF= -ma -DYYDEBUG -DLEXDEBUG
#endif
#ifdef vax
CCDEF= -DYYDEBUG -DLEXDEBUG
#endif
#if defined(mips) && defined(ultrix)
CCDEF= -Wf,-XNh1200 -DYYDEBUG -DLEXDEBUG
#endif
#if defined(_AUX_SOURCE)
#define CcCmd gcc -traditional
#endif
#if defined(SOLARIS)
CC = /mit/sunsoft/sun4bin/cc 
CCDEF= 
LDLIBS=  -lsocket -lnsl  -lelf -lw -ldl
#endif

LEX_LIB=	-ll

#ifdef linux
LEX_LIB=	-lfl
#endif

LIBS = $(YACC_LIB) $(LEX_LIB)

DEFINES= $(CCDEF)

SimpleProgram(synctree, $(OBJS),$(LIBS),$(BINDIR))
install_man(synctree.man,synctree.8)

build_program(regexp,regexp.o,,)

synctree.o: synctree.c switch.c
regexp.o: regexp.c
	$(CC) $(CFLAGS) -DTEST -c $*.c

y.tab.o: y.tab.c lex.yy.c synctree.h

y.tab.c: readrules.y
	yacc -vd readrules.y

lex.yy.c: readrules.l
	lex -v readrules.l

version.c: $(SRCS) switch.c synctree.h readrules.y readrules.l
	@echo "Ignore the 'version.c: cannot create' warning, if one appears"
	-./newvers.sh
