# Makefile for LQ-Text, a full text retrieval package by Liam R. Quin
# This Makefile belongs in the "src/lqtext" directory.
#
# Note that most of the actual configuration is done in ../Makefile and
# in ../h/global.h, and not here.

# Makefile -- Copyright 1990 Liam R. Quin.  All Rights Reserved.
# This code is NOT in the public domain.
# See the file ../COPYRIGHT for full details.
#
# $Id: Makefile,v 1.6 92/02/15 05:05:13 lee Exp $


PWD=lqtext

TARGETS = lqaddfile lqfile lqword lqphrase lqshow lqkwik mkwidtable \
	lqwordlist lq intersect lqrename \
	# lqmkfree lines mksignatures lqwordslike
BINFILES =lqaddfile lqfile lqword lqphrase lqshow lqkwik mkwidtable \
	lqwordlist lqrename # lqmkfree lines mksignatures lqwordslike

DESTDIR=../bin
MODE=755
RANLIB=echo

EXTRA=-I../h

all: $(TARGETS)

# for ndbm (simplest), leave empty or use -lndbm if you need it
# for sdbm (best so far), use ../lib/libsdbm.a
# for gdbm... well, I dunno.
DBMLIBS=../lib/libsdbm.a
# DBMLIBS=-lndbm
# DBMLIBS=ndbm.o bcopy.o

TEXTLIB=../lib/liblqtext.a ../lib/liblq.a ../lib/liblqerror.a

# The following are for "make depend" and for sabre to load...
DEPENDFILES = ReadAhead.c fileindex.c lqaddfile.c lqphrase.c \
	      lqshow.c lqword.c sizes.c wordtable.c mkwidtable.c

# MALLFILES=/usr/lib/debug/malloc.o /usr/lib/debug/mallocmap.o
MALLFILES = 

install: all
	for i in $(BINFILES); do cp "$$i" $(DESTDIR); \
	strip "$(DESTDIR)/$$i" ; \
	done ; \
	mv lq $(DESTDIR)/lq; chmod $(MODE) $(DESTDIR)/lq;
	mv intersect $(DESTDIR)/intersect; chmod $(MODE) $(DESTDIR)/intersect;

.SUFFIXES: .c .o .src .obj

.c.src:
	#load $(CFLAGS) $<

.o.obj:
	#load $(CFLAGS) $<

# If you are going to use saber on these, you should name the programs.
saber_src:

saber_obj:

lq: lq.sh
	cp lq.sh lq
	chmod +x lq

intersect: intersect.sh
	cp intersect.sh intersect
	chmod +x intersect

lqshow: lqshow.o $(TEXTLIB)
	$(CC) $(CFLAGS) -o lqshow lqshow.o $(TEXTLIB) $(TERMCAP) $(DBMLIBS)

lines: lines.o $(TEXTLIB)
	$(CC) $(CFLAGS) -o lines lines.o $(TEXTLIB)
	
lqrename: lqrename.o $(TEXTLIB)
	$(CC) $(CFLAGS) -o lqrename lqrename.o \
			$(TEXTLIB) $(MALLOC) $(DBMLIBS) $(MALLFILES)

lqaddfile: lqaddfile.o wordtable.o $(TEXTLIB)
	$(CC) $(CFLAGS) -o lqaddfile lqaddfile.o wordtable.o \
			$(TEXTLIB) $(MALLOC) $(DBMLIBS) $(MALLFILES)

lqfile: fileindex.o $(TEXTLIB)
	$(CC) $(CFLAGS) -o lqfile fileindex.o $(TEXTLIB) $(MALLOC) $(DBMLIBS)
	
lqmkfree: lqmkfree.o $(TEXTLIB)
	$(CC) $(CFLAGS) -o lqmkfree lqmkfree.o $(TEXTLIB) $(DBMLIBS) $(MALLOC)

lqword: lqword.o $(TEXTLIB)
	$(CC) $(CFLAGS) -o lqword lqword.o $(TEXTLIB) $(MALLOC) $(DBMLIBS)

lqwordlist: lqwordlist.o $(TEXTLIB)
	$(CC) $(CFLAGS) -o lqwordlist lqwordlist.o $(TEXTLIB) $(MALLOC) $(DBMLIBS)

lqkwik: lqkwik.o $(TEXTLIB)
	$(CC) $(CFLAGS) -o lqkwik lqkwik.o $(TEXTLIB) $(MALLOC) $(DBMLIBS)

lqphrase: lqphrase.o $(TEXTLIB)
	$(CC) $(CFLAGS) -o lqphrase lqphrase.o $(TEXTLIB) $(DBMLIBS)

mksignatures: mksignatures.o $(TEXTLIB)
	$(CC) $(CFLAGS) -o mksignatures mksignatures.o $(TEXTLIB) $(MALLOC) $(DBMLIBS)

lqwordslike: lqwordslike.o $(TEXTLIB)
	$(CC) $(CFLAGS) -o lqwordslike lqwordslike.o $(TEXTLIB) $(MALLOC) $(DBMLIBS)

mkwidtable: mkwidtable.o $(TEXTLIB)
	$(CC) $(CFLAGS) -o mkwidtable mkwidtable.o $(TEXTLIB) $(MALLOC) $(DBMLIBS)

lint: AddFile.Lint News.Lint FileInfo.Lint Phrase.Lint

tidy:
	/bin/rm -f *.o core

clean: tidy
	/bin/rm -f $(TARGETS) $(TEST)

depend:
	chmod +w Makefile
	mkdep $(CFLAGS) *.c

# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.

# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
