# Generated automatically from Makefile.in by configure.
# $Id: Makefile,v 1.1.1.1 2002/05/29 20:17:14 csieh Exp $

srcdir=.
prefix=/usr
exec_prefix=
sbindir=${exec_prefix}/sbin
mandir=${prefix}/man

ARCH		= alpha
CC		= gcc
CFLAGS		= -Os -Wall
LDFLAGS		= 
HOSTCC		= gcc
HOSTCFLAGS	= -Os -Wall
AR		= ar
RANLIB		= ranlib
INSTALL		= install
STRIP		= -s

PARSERCFLAGS	= -Wno-uninitialized

DEFS = -I. -I$(srcdir) -I$(srcdir)/../include -D_GNU_SOURCE  -DCONFIG_ROOT_CHECK_OFF=0  $(EXTRA_DEFS)

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

######################################################################

all: genksyms

genksyms: genksyms.o parse.o lex.o ../util/libutil.a
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

parse.o: parse.c
	$(CC) $(CFLAGS) $(PARSERCFLAGS) $(DEFS) -c -o $@ $<

parse.c parse.h: parse.y
	@echo "expect 6 shift/reduce conflicts and 5 reduce/reduce conflicts."
	bison -o parse.c -dtv $^

lex.o: lex.c
	$(CC) $(CFLAGS) $(PARSERCFLAGS) $(DEFS) -c -o $@ $<

lex.c: lex.l parse.h
	flex -o$@ -d $^

crc32.tab: makecrc32.c
	$(HOSTCC) $(HOSTCFLAGS) -o makecrc32 $^
	./makecrc32 > $@.tmp
	mv $@.tmp $@

keywords.c: keywords.gperf
	gperf -a -C -E -g -H is_reserved_hash -k 1,3,$$ -N is_reserved_word -p -t $^ > $@.tmp
	mv $@.tmp $@

clean:
	rm -f *.o *.tmp parse.output genksyms makecrc32

realclean: clean
	rm -f .depend parse.c parse.h lex.c crc32.tab

	# rm -f keywords.c     gperf is not on all distributions

distclean: realclean
	rm -f Makefile

install install-bin: all
	$(INSTALL) $(STRIP) genksyms $(sbindir)

# auto-generated dependancies are almost redundant once we add all the
# rules to get the generated files built first.
dep depend:

genksyms.o: genksyms.c crc32.tab genksyms.h \
  $(srcdir)/../include/util.h $(srcdir)/../include/version.h
lex.o: lex.c keywords.c genksyms.h parse.c $(srcdir)/../include/util.h
parse.o: parse.c genksyms.h