#
#  Makefile for the enumerators
#
#  Makefile.in,v 1.36 1996/01/06 08:04:41 duane Exp
#
prefix = @prefix@
INSTALL_BINDIR	= $(prefix)/bin
INSTALL_LIBDIR	= $(prefix)/lib
INSTALL_UTILDIR	= $(INSTALL_LIBDIR)/gatherer
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_LDFLAGS	=
DEBUG_LIBS	= 

INCLUDE		= -I../../common/include -I../include
CFLAGS		= $(DEBUG) $(INCLUDE)
LIBDIR		= ../../common/lib
LDFLAGS		= -L$(LIBDIR)
LIBS		= -lurl -lmd5 -lutil -lgdbm -lregex $(DEBUG_LIBS) $(XTRA_LIBS)
FILTER_OBJS	= filter.o robots-txt.o
HTML_OBJS	= HTMLparse.o
PROGS		= enum fileenum ftpenum httpenum gopherenum newsenum \
		  staturl HTMLurls
SCRIPTS		= ftpenum.pl
PERLS		= dateconv.pl lsparse.pl timelocal.pl
GLIBFILES	= URL-filter-default

all:		$(PROGS) $(PERLS)

clean:
	-rm -f core *.o $(PROGS) tags enum.log tmpdb.gdbm

realclean:	clean
	-rm -f Makefile

install:	all install-bin
	@for f in $(GLIBFILES); do \
		echo $(INSTALL_FILE) $$f $(INSTALL_UTILDIR); \
		$(INSTALL_FILE) $$f $(INSTALL_UTILDIR); \
	done

install-bin:	$(PROGS)
	@for f in $(PROGS) $(SCRIPTS); do \
		echo $(INSTALL_BIN) $$f $(INSTALL_UTILDIR); \
		$(INSTALL_BIN) $$f $(INSTALL_UTILDIR); \
	done
	@for f in $(PERLS); do \
		echo $(INSTALL_BIN) $$f $(INSTALL_LIBDIR); \
		$(INSTALL_BIN) $$f $(INSTALL_LIBDIR); \
	done


enum:   enum.o
	$(CC) -o $@ $@.o $(LDFLAGS) -ltemplate $(LIBS) 

staturl:	staturl.o 
	$(CC) -o $@ $@.o $(LDFLAGS) $(LIBS)

ftpenum:   ftpenum.o
	$(CC) -o $@ $@.o ${LDFLAGS} $(LIBS)

fileenum:   fileenum.o $(FILTER_OBJS) 
	$(CC) -o $@ $@.o $(FILTER_OBJS) $(LDFLAGS) $(LIBS)

httpenum:	httpenum.o $(FILTER_OBJS)
	$(CC) -o $@ $@.o $(FILTER_OBJS) $(LDFLAGS) $(LIBS)

gopherenum:	gopherenum.o $(FILTER_OBJS)
	$(CC) -o $@ $@.o $(FILTER_OBJS) $(LDFLAGS) $(LIBS)

newsenum:	newsenum.o $(FILTER_OBJS)
	$(CC) -o $@ $@.o $(FILTER_OBJS) $(LDFLAGS) $(LIBS)

HTMLurls:	$(HTML_OBJS) HTMLurls.o
	$(CC) -o $@ $@.o $(HTML_OBJS) $(LDFLAGS) -lurl -lutil
