# Makefile.in,v 1.20 1995/09/01 02:13:22 duane Exp
# Copyright (c) 1994 Sun Wu, Udi Manber, Burra Gopal.  All Rights Reserved.

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@

COMMONDIR	= ../../../../../src/common
DEFS		= -DMEASURE_TIMES=0 -DAGREP_POINTER=1 -DDOTCOMPRESSED=0 -I$(COMMONDIR)/include
CFLAGS	      	= -DISO_CHAR_SET $(DEBUG_TOP) $(DEFS) -w
CFLAGS_AGREP 	= $(DEFS) -w

# You might have to change these depending on your machine configuration.
# AR and RABLIB are the library-archive programs. On Solaris, RANLIB is not
# required (define it to true) and AR is in /usr/ccs/bin/ar (on our machine!).
AR	      = ar #/usr/ccs/bin/ar #for Solaris

# YOU DON'T HAVE TO CHANGE ANYTHING BELOW THIS LINE

# The binaries will be made in ../bin/. and the agrep library in ../lib
# You normally don't have to change them.
BINDIR	      = ../bin
LIBDIR	      = ../lib
TCOMP	      =	cast
TCOMPDIR      = ../compress
AGREPDIR      = ../agrep

PROG	      = agrep
NOTCPROG      = notc$(PROG)

# You can change the target to use the "dummyfilter" so that agrep does not
# use the cast library by changing:
#	all: $(PROG)
# to:
#	all: $(NOTCPROG)
# Both create libagrep.a which can be linked with user a program.
# You also have to define DOTCOMPRESSED=0 above.
# At present, the compression library "cast" has been removed from agrep.

LIB	      = $(LIBDIR)/lib$(PROG).a
HDRS	      =	agrep.h checkfile.h re.h defs.h config.h
TCOMPLIBOBJ   = $(TCOMPDIR)/hash.o \
		$(TCOMPDIR)/string.o \
		$(TCOMPDIR)/misc.o \
		$(TCOMPDIR)/quick.o \
		$(TCOMPDIR)/cast.o \
		$(TCOMPDIR)/uncast.o \
		$(TCOMPDIR)/tsimpletest.o \
		$(TCOMPDIR)/tbuild.o\
		$(TCOMPDIR)/tmemlook.o
OBJS	      =	follow.o asearch.o asearch1.o agrep.o bitap.o checkfile.o \
		compat.o maskgen.o parse.o checksg.o preprocess.o \
		delim.o	asplit.o recursive.o sgrep.o newmgrep.o utilities.o dummyfilters.o

all: do-lib

Glimpseall: $(PROG)
	cp $(PROG) $(BINDIR)/.


do-lib:	$(OBJS)
	$(AR) rc $(LIB) $(OBJS)
	$(RANLIB) $(LIB)

$(PROG):	do-lib $(OBJS) main.o
		$(CC) -L$(LIBDIR) $(CFLAGS) -o $@ $(OBJS) main.o

$(LIBDIR)/lib$(TCOMP).a:
		cd $(TCOMPDIR) ; $(MAKE)

$(NOTCPROG):	$(OBJS) dummyfilters.o main.o
		$(CC) $(CFLAGS) -o $(PROG) $(OBJS) dummyfilters.o main.o
		$(AR) rcv $(LIB) $(OBJS) dummyfilters.o
		$(RANLIB) $(LIB)

clean:
		-rm -f $(LIB) $(OBJS) dummyfilters.o main.o core a.out $(PROG)

realclean:	clean
		-rm -f Makefile

asearch.o:	agrep.h defs.h config.h
asearch1.o:	agrep.h defs.h config.h
bitap.o:	agrep.h defs.h config.h
checkfile.o:	checkfile.h config.h
follow.o:	re.h config.h
main.o:		agrep.h checkfile.h defs.h config.h
agrep.o:	agrep.h checkfile.h defs.h config.h
newmgrep.o:	agrep.h defs.h config.h
maskgen.o:	agrep.h defs.h config.h
next.o:		agrep.h defs.h config.h
parse.o:	re.h config.h
preprocess.o:	agrep.h defs.h config.h
checksg.o:	agrep.h checkfile.h defs.h config.h
delim.o:	agrep.h defs.h config.h
asplit.o:	agrep.h defs.h config.h
sgrep.o:	agrep.h defs.h config.h
abm.o:		agrep.h defs.h config.h
utilities.o:	re.h config.h
dummyfilters.o:	dummyfilters.c config.h

agrep.o:
	$(CC) $(CFLAGS_AGREP) -c agrep.c
