#
#  Makefile for the GDBM database utilities source directory 
#
prefix = @prefix@
INSTALL_BINDIR	= $(prefix)/bin
INSTALL_LIBDIR	= $(prefix)/lib
INSTALL_UTILDIR	= $(prefix)/lib/gatherer
INSTALL_MANDIR	= $(prefix)/man

CC		= @CC@
INSTALL		= @INSTALL@
INSTALL_BIN	= @INSTALL_PROGRAM@
INSTALL_FILE	= @INSTALL_DATA@
RANLIB		= @RANLIB@
XTRA_LIBS	= @XTRA_LIBS@

GDBM_DEFINE	=
GDBM_INCLUDE	= 
GDBM_LDFLAGS	= 
GDBM_LIBS	= -lgdbm

DEBUG		= $(DEBUG_TOP) #-O #-g #-DDEBUG
DEBUG_LDFLAGS	=
DEBUG_LIBS	= 
DEFINES		=

LIBDIR		= ../../../common/lib
INCLUDE		= -I../../../common/include $(GDBM_INCLUDE)
LDFLAGS		= -L$(LIBDIR) $(GDBM_LDFLAGS)
LIBS		= -lutil $(GDBM_LIBS) $(DEBUG_LIBS) $(XTRA_LIBS)

CFLAGS		= $(DEBUG) $(DEFINES) $(INCLUDE) $(GDBM_DEFINE)
OBJS		= gdbmconsolidate.o gdbmdelete.o gdbmdump.o gdbmfetch.o \
		  gdbmkeys.o gdbmprint.o gdbmreorg.o gdbmrestore.o \
		  gdbmsort.o gdbmstore.o gdbmutil.o gdbmstats.o

PROGS		= gdbmutil

all:	$(PROGS)

ctags:
	@ctags -w *.c

clean:
	-rm -f core $(PROGS) *.o tags mon.out Makefile.bak

realclean:	clean
	-rm -f Makefile

install:	all
	@for f in $(PROGS); do \
		echo $(INSTALL_BIN) $$f $(INSTALL_UTILDIR); \
		$(INSTALL_BIN) $$f $(INSTALL_UTILDIR); \
	done

gdbmutil:	$(OBJS)	
	$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS)
