
# programs
CC     = @CC@
AR     = ar
RANLIB = @RANLIB@
LEX     = @LEX@
YACC    = @YACC@
SHELL  = /bin/sh

srcdir      = @srcdir@
VPATH       = @srcdir@

COMMON_INC  = -I$(srcdir)/../common
COMMON_LIBS = -L../common -lrwcommon

REGEXP_INC  = -I$(srcdir)/../regexp
REGEXP_LIBS = -L../regexp -lregexp

# options
LOCAL_INC   = -I$(srcdir) -I.. $(COMMON_INC) $(REGEXP_INC)
LOCAL_LIBS  = $(COMMON_LIBS) $(REGEXP_LIBS)

LOCAL_OPTIONS =

CFLAGS     = @CFLAGS@
ALL_CFLAGS = $(CFLAGS) $(LOCAL_INC) $(LOCAL_OPTIONS) @DEFS@

LDFLAGS = @LDFLAGS@

LIBS    = $(LOCAL_LIBS) @LIBS@

PARSEOBJS = y.tab.o \
            @LEX_OUTPUT_ROOT@.o
OBJS =  \
        anon_record.o \
        delete.o \
        fileinfo.o \
        index.o \
        index_file.o \
        metaphon.o \
        records.o \
        search.o \
        search_prim.o \
        $(PARSEOBJS)

#
# rwhois files
#

all: libmkdb.a

libmkdb.a:$(OBJS)
	$(AR) cru $@ $(OBJS)
	$(RANLIB) $@

.SUFFIXES:
.SUFFIXES: .c .o

.c.o:
	$(CC) $(ALL_CFLAGS) -c $<

#
# lex and yacc specific dependancies
#

# note that using '$<' to refer to the first dependency is unsafe, so
# we have to refer to dependency directly in the rule.
y.tab.c: parse.y
	$(YACC) -d $(srcdir)/parse.y

@LEX_OUTPUT_ROOT@.c: parse.l
	$(LEX) $(srcdir)/parse.l

# administrative rules

install:

uninstall:

clean:
	rm -f *.o *.a

distclean: clean
	rm -f Makefile
