#/* Copyright (c) 1994 Burra Gopal, Udi Manber.  All Rights Reserved. */
# Makefile for the compress library -- agrep should be linked with it in case
# it wants to search for patterns in a compressed file.

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

srcdir = @srcdir@
VPATH  = @srcdir@
SHELL  = /bin/sh
CC     = @CC@
RANLIB = @RANLIB@
INSTALL		= @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@
DEFS		= @DEFS@

prefix = @prefix@
exec_prefix = $(prefix)
binprefix =
manprefix =

bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
mandir = $(prefix)/man/man1
manext = 1

INDEX = ../index
INDEXSRC = $(srcdir)/$(INDEX)
AGREP = ../agrep
AGREPSRC = $(srcdir)/$(AGREP)
TEMPLATE = ../libtemplate
TEMPLATESRC = $(srcdir)/$(TEMPLATE)

all: lib tbuild cast uncast test

CFLAGS = -O
ALL_CFLAGS    = $(CFLAGS) $(DEFS) -I$(INDEXSRC) -I$(AGREPSRC) -I$(TEMPLATESRC)/include

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

LIBOBJ = hash.o string.o misc.o quick.o cast.o uncast.o tsimpletest.o tmemlook.o tbuild.o
LIB = libcast.a

lib: $(LIBOBJ)
	$(AR) rcv $(LIB) $(LIBOBJ)
	$(RANLIB) $(LIB)

test: hash.o string.o misc.o test.o quick.o tsimpletest.o tmemlook.o cast.o uncast.o
	 $(CC) -o test hash.o string.o misc.o test.o quick.o tsimpletest.o tmemlook.o cast.o uncast.o

tbuild: hash.o string.o misc.o tbuild.o main_tbuild.o defs.h
	 $(CC) -o tbuild hash.o string.o misc.o tbuild.o main_tbuild.o

cast: main_cast.o $(LIB)
	 $(CC) -o cast main_cast.o $(LIBOBJ)

uncast: main_uncast.o $(LIB)
	$(CC) -o uncast main_uncast.o $(LIBOBJ)

hash.o: defs.h $(INDEXSRC)/glimpse.h
string.o: defs.h $(INDEXSRC)/glimpse.h
misc.o: defs.h $(INDEXSRC)/glimpse.h
quick.o: defs.h $(INDEXSRC)/glimpse.h
cast.o: defs.h $(INDEXSRC)/glimpse.h
uncast.o: defs.h $(INDEXSRC)/glimpse.h
main_cast.o: defs.h $(INDEXSRC)/glimpse.h
main_uncast.o: defs.h $(INDEXSRC)/glimpse.h
tsimpletest.o: defs.h $(INDEXSRC)/glimpse.h
tmemlook.o: defs.h $(INDEXSRC)/glimpse.h
test.o : test.c

clean:
	rm -f *.o $(LIB) core test cast uncast tbuild a.out

