CC=		gcc
CFLAGS=		-O
LDFLAGS=	
#LIBS=		-lndbm
#LIBS=		-L/usr/athena/lib -lsocket -lresolv -lnsl
INSTALL=	/mit/gnu/bin/ginstall

prefix=		/mit/sipb
BINDIR=         $(prefix)/bin
LIBDIR=         $(prefix)/share/cheesaurus
MANDIR=		$(prefix)/man/man1

all: cheesaurus thesaurus.indx

thesaurus.indx: makeindex thesaurus.dat
	./makeindex thesaurus.dat thesaurus.indx > index.out

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

makeindex: makeindex.o hash.o
	$(CC) $(LDFLAGS) makeindex.o hash.o -o $@

cheesaurus: thesaurus.o hash.o
	$(CC) $(LDFLAGS) thesaurus.o hash.o -o $@

clean:
	rm -f thesaurus makeindex thesaurus.indx index.out *.o *~

install:: all
	$(INSTALL) -c -s cheesaurus $(BINDIR)
	$(INSTALL) -c -m 644 cheesaurus.1 $(MANDIR)
	$(INSTALL) -d $(LIBDIR)
	$(INSTALL) -c -m 644 thesaurus.dat  $(LIBDIR)
	$(INSTALL) -c -m 644 thesaurus.indx $(LIBDIR)
