# This is the Makefile from the WAIS system, modified to build the 
# TechInfor version of the search engine
#     autumn 1/93


# This is a sample server, Z39.50 library, and a user interface stub
#  The Z39.50 library was primariy written by Harry Morris and the search
#  engine was primarily written by Brewster Kahle.
#  -brewster 4/90

# $Log:	Makefile-release,v $
# Revision 1.8  92/05/10  14:42:26  jonathan
# Changed CLIENT_LOCAL_SRC ot ui-local.c.  Added link to ui.c
# 
# Revision 1.7  92/04/30  12:30:22  jonathan
# Changed CC = to use cc instead.  It's the right thing to do...
# 
# Revision 1.6  92/04/28  17:09:05  jonathan
# Added lock.[co] to lists.
# 
# Revision 1.5  92/02/27  09:15:28  jonathan
# fixed compile line for ui-local.o
# 
# Revision 1.4  92/02/24  10:06:59  jonathan
# Removed -DBOOL from CFLAGS
# 
# Revision 1.3  92/02/13  13:02:44  jonathan
# Added CLIENT_LIB to default, and fixed rule.
# 
# Revision 1.2  92/02/13  12:28:26  jonathan
# Removed object and boolean sources from definitions.
# 
# Revision 1.1  92/02/13  11:55:08  jonathan
# Initial revision
# 
#

# Common customizations:
#  If a namespace resolver is not used (gethostbyname),
#   set RESOLVER to nothing, otherwise -lresolv
#  gcc vs cc:  This library was written on a bunch of ANSI routines.
#   the ones that did not exist in gcc or for non-ANSI cc are in ustubs.c
# for old BSD cc or System V, see cflags below

INDEX_CMD	= $(TOP)/@sys/waisindex
INV_LIB 	= $(TOP)/inv.a		# file name of the inverted file library
PROTOCOL_LIB 	= $(TOP)/prot.a		# file name of the protocol library
LIBFTW		= $(TOP)/libftw.a		# support library
IR_LIB		= $(TOP)/ir.a

RM = /bin/rm -f
AR = ar 
ARFLAGS = r
# on SGIs, set this to true
RANLIB = ranlib

#
# Files.
#

# List of source files for saber.

PROTOCOL_SRC = \
		cutil.c \
		futil.c \
		ircfiles.c \
		irfiles.c \
		panic.c \
		ustubs.c \
		list.c \
		lock.c



INV_SRC  = \
		irsearch.c \
		dochash.c \
		sersrch.c \
		irhash.c \
		irtfiles.c \
		hash.c \
		trie.c \
		stoplist.c \
		irinv.c

INDEX_SRC =	irbuild.c


# List of object files for saber and regular compilation.
# Should correspond to source files.

PROTOCOL_OBJ =	\
		cutil.o  \
		futil.o   \
		ircfiles.o \
		irfiles.o \
		panic.o \
		ustubs.o \
		list.o \
		lock.o


INV_OBJ  = \
		irsearch.o \
		dochash.o \
                sersrch.o \
		irtfiles.o \
                irhash.o \
        	stoplist.o \
	        hash.o \
                irinv.o \
		trie.o

INDEX_OBJ = irbuild.o


#
# Compilation.
#

# C Compiler.  Use either cc or gcc.  Comment this out in release to
# inherit from top level.
# CC = cc

# Compiler & linker flags.
# Compiler debug flag.  Use -g for debugging, -O for optimization.
# for antique bsd add -DBSD 
# for System V add -DSYSV 
# for XENIX add -M3e -Zi
# -DSECURE_SERVER for waisserver to setuid to uucp after startup.
CFLAGS = -g

# dealing with taking an intenet name and resolving it.  
# set to -lresolv or nothing
RESOLVER=	#-lresolv 

default:	$(PROTOCOL_LIB) \
		$(INV_LIB) \
		$(INDEX_CMD) 
		
$(PROTOCOL_LIB):	$(PROTOCOL_OBJ)
			$(AR) $(ARFLAGS) $@ $(PROTOCOL_OBJ)
			$(RANLIB) $@

$(INV_LIB): 	$(INV_OBJ)
		$(AR) $(ARFLAGS) $@ $(INV_OBJ)
		$(RANLIB) $@

$(INDEX_CMD):	$(INDEX_OBJ) $(PROTOCOL_LIB) $(INV_LIB) $(LIBFTW)
		$(RM) $@
		$(CC) $(CFLAGS) -o $@ $(INDEX_OBJ) \
		 $(INV_LIB) $(PROTOCOL_LIB) $(LIBFTW) -lm;


#
# Saber loading.  Tuned for Saber 3.0
#

# Load source code into saber.
index_src:	$(INV_SRC) $(INDEX_SRC)
		#suppress 53
		#suppress 529
		#suppress 530
		#suppress 558
		#suppress 590
		#suppress 592
		#suppress 701 on strspn 
		#suppress 701 on strlen 
		#suppress 701 on strcspn
		#suppress 594 on waislog
		#load $(CFLAGS) $(INV_SRC) $(INDEX_SRC)

CSFLAGS = -D_ansi_prototypes -Dsparc -I/usr/include/cs/6.0.2 -I/usr/include 


pump_question_src:	$(INV_SRC) pump_question.c
		#suppress 35
		#suppress 53
		#suppress 57
		#suppress 530
		#suppress 529
		#suppress 558
		#suppress 590
		#suppress 592
		#suppress 701 on strspn 
		#suppress 701 on strlen 
		#suppress 701 on strcspn
		#suppress 594 on waislog 
		#load $(CFLAGS) -I./ $(INV_SRC) pump_question.c
		#load /usr/lib/libm.a

# Remove objects and library.
clean:
	$(RM) *.o
	$(RM) *~
	$(RM) \#*\#
	$(RM) .nfs*  # NFS lossage
	$(RM) *.elc
	$(RM) $(INDEX_CMD)
	$(RM) $(PROTOCOL_LIB)
	$(RM) $(INV_LIB) 
	$(RM) $(IR_LIB)
	$(RM) SearchLog
	$(RM)  core




