#
# UI's for the WAIS system
#  -brewster 2/91
#
# $Log:	Makefile,v $
# Common customizations:
# for the NEXT machine, HP machines, or old BSD cc, see cflags

VERSION = 86

SHELL_UTIL_CMD = ../bin/waisq
SCREEN_UI_CMD = ../bin/swais

# For a smaller client, but with no local search,
# use this line this to:
# IR_LIB	= ../bin/client.a

IR_LIB	= ../bin/inv.a

SIG_LIB = ../bin/sig.a

PROTOCOL_LIB	= ../bin/wais.a

UI_LIB = $(IR_LIB) $(PROTOCOL_LIB)

UI_SIG_LIB = ../ir/seeker_dummy.o $(SIG_LIB) $(PROTOCOL_LIB)

PROTDIR = ../ir
LIBDIR = ../lib
SRCDIR = ./

RM = /bin/rm -f

#
# Files.
#

#
# Compilation.
#

# C Compiler.  Use either cc or gcc.
CC = gcc

# Compiler & linker flags.
# Compiler debug flag.  Use -g for debugging, -O for optimization.
# for antique bsd add -DBSD 
# for XENIX add -M3e -Zi
CFLAGS = -g -I$(PROTDIR) -I$(LIBDIR) -DTELL_USER

# this is for SunOS 4.X
# LFLAGS = -Bstatic

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

default: $(SHELL_UTIL_CMD) $(SCREEN_UI_CMD) wais.el

QUES =  waisq.c

QOBJ =  waisq.o \
 	question.o \
 	wais-ui.o \
	document.o

SOBJ =  screen-ui.o \
 	question.o \
 	wais-ui.o \
	document.o

OBJS =  util.o \
	source.o

SSRC =  screen-ui.c \
 	question.c \
	document.c \
	wais-ui.c

QSRC =  waisq.c \
 	question.c \
	document.c \
	wais-ui.c

SRC =  	util.c \
	source.c

$(IR_LIB):
	(cd ../ir;make ${IR_LIB})

$(SIG_LIB):
	(cd ../ir;make ${SIG_LIB})

$(PROTOCOL_LIB):
	(cd ../ir;make ${PROTOCOL_LIB})

$(SHELL_UTIL_CMD): $(QOBJ) $(OBJS) $(UI_LIB)
	$(RM) $@; \
	$(CC) $(LFLAGS) $(CFLAGS) -o $@ $(QOBJ) $(OBJS) $(UI_LIB) $(LIBS) \
		-lm $(RESOLVER)

$(SCREEN_UI_CMD): $(SOBJ) $(OBJS) $(UI_LIB)
		$(RM) $@; \
		$(CC) $(CFLAGS) $(LFLAGS) -o $@ \
		      $(SOBJ) $(OBJS) $(UI_LIB) -lcurses -ltermcap -lm $(RESOLVER);

wais.el: wais.el.raw
	./fix-gmacs.sh wais.el

# Remove objects and library.
clean:
	$(RM) *.o
	$(RM) *.sbin *.sbin3
	$(RM) *~
	$(RM) \#*\#
	$(RM) .nfs*  # NFS Lossage
	$(RM) wais.elc wais.el
	$(RM) $(SHELL_UTIL_CMD)
	$(RM) $(SCREEN_UI_CMD)
	$(RM) core
