#
#  Makefile for the Essence summarizer source directory
#
#  Makefile.in,v 1.16 1995/07/20 02:11:24 hardy Exp
#
prefix = @prefix@
INSTALL_BINDIR	= $(prefix)/bin
INSTALL_LIBDIR	= $(prefix)/lib
INSTALL_MANDIR 	= $(prefix)/man

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

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

INCLUDE		= -I../include -I../../common/include
CFLAGS 		= $(DEBUG) $(INCLUDE)
LIBDIR		= ../lib
LDFLAGS		= -L$(LIBDIR) -L../../common/lib
LIBS		= -lurl -lutil -lmd5 -lgdbm $(DEBUG_LIBS) $(XTRA_LIBS)
OBJS		= urld.o urld_queue.o urld_util.o
PROGS		= urld urldget
SCRIPTS		= 

LIBFILE		= liburld_client.a
LIB_OBJS	= urld_client.o ccache_util.o

all:		install-lib $(PROGS)

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

clean:
	-rm -f core *.o $(PROGS) $(LIBFILE) tags

realclean:	clean
	-rm -f Makefile

$(LIBFILE):	$(LIB_OBJS)
	ar r $(LIBFILE) $(LIB_OBJS) 
	$(RANLIB) $(LIBFILE)

install-lib:	$(LIBDIR)/$(LIBFILE)

$(LIBDIR)/$(LIBFILE):	$(LIBFILE)
	$(INSTALL_FILE) $(LIBFILE) $(LIBDIR)/$(LIBFILE)
	$(RANLIB) $(LIBDIR)/$(LIBFILE)

urld:	$(OBJS)
	$(CC) -o $@ $(OBJS) $(LDFLAGS) $(LIBS)

urldget:	urldget.o
	$(CC) -o $@ $@.o $(LDFLAGS) -lurld_client -lutil

urld.o:	urld.c
	$(CC) $(CFLAGS) -DDAEMON -c urld.c -o $@

ccache_util.o:	../../common/url/ccache_util.c
	$(CC) $(CFLAGS) -c ../../common/url/ccache_util.c -o $@
