#********************************************************************
# $Author: lindner $
# $Revision: 1.3 $
# $Date: 1992/12/21 20:44:37 $
# $Source: /home/mudhoney/GopherSrc/gopher1.12/gopherd/RCS/Makefile,v $
# $Status: $
#
# Paul Lindner, University of Minnesota CIS.
#
# Copyright 1991, 1992 by the Regents of the University of Minnesota
# see the file "Copyright" in the distribution for conditions of use.
#********************************************************************
# MODULE: Makefile
# Makefile for gopher server
#*********************************************************************
# Revision History:
# $Log: Makefile,v $
# Revision 1.3  1992/12/21  20:44:37  lindner
# Added kernutils.o to OBJS (from mtm)
#
# Revision 1.2  1992/12/21  20:21:49  lindner
# Added ../bin/libftw.a to WAISGATEOBJS..
#
# Revision 1.1  1992/12/10  23:15:15  lindner
# gopher 1.1 release
#
#
#********************************************************************/
include ../Makefile.config

#
# Type of full-text searching to use....  WAIS
# requires that you have a built wais distribution.
#
# Next requires that you have the NeXTtext.tar.Z libraries.
#

LIBS	= $(SERVERLIBS)

NEXTLIBS	= -ltext -lbtree


#############################################################################

NEXTOBJ = NeXTindex.o

WAISGATEOBJ = ../ui/source.o ../bin/libftw.a

WAISOBJ = ../bin/inv.a  ../bin/wais.a ../bin/client.a $(WAISGATEOBJ)

CCFLAGS	= $(OPT) -DDATA_DIRECTORY=\"$(SERVERDATA)\" \
	-DDOMAIN_NAME=\"$(DOMAIN)\" \
	-DGOPHER_PORT=$(SERVERPORT) \
	$(SEARCH) \
	$(SERVEROPTS) \
	$(GSYSTYPE) \
	$(INCLUDES)

OBJS	= error.o globals.o gopherd.o daemon.o special.o \
	dedot.o openers.o index.o Waisindex.o serverutil.o ftp.o \
	waisgopher.o ext.o site.o gopherdconf.o kernutils.o

TARGET	= gopherd

all:
	(cd ..; $(MAKE) $(MFLAGS) server)

#
# Special rule for NeXT text indexing.
#
NeXTindex.o : NeXTindex.c
	$(CC) $(CCFLAGS) -ObjC -I. -c NeXTindex.c


#
# Special rule for wais gateway
#
waisgopher.o: waisgopher.c
	$(CC) $(CCFLAGS) -c waisgopher.c

gopherd.o: gopherd.c
	$(CC) $(CCFLAGS) -DCONF_FILE=\"$(SERVERDIR)/gopherd.conf\" -c gopherd.c


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

globals.o : globals.h

$(OBJS) : ../conf.h


next: $(OBJS) $(NEXTOBJ)
	$(CC) $(LDFLAGS) -o $(TARGET) $(OBJS) $(NEXTOBJ) $(DLOBJS) \
		$(LIBS) $(NEXTLIBS)

wais: $(OBJS)
	$(CC) $(LDFLAGS) -o $(TARGET) $(OBJS) $(WAISOBJ) $(DLOBJS) $(LIBS)

nextwais: $(OBJS) $(NEXTOBJ)
	$(CC) $(LDFLAGS) -o $(TARGET) $(OBJS) $(NEXTOBJ) $(LIBS) \
		$(WAISOBJ) $(DLOBJS) $(NEXTLIBS)

none: $(OBJS)
	$(CC) $(LDFLAGS) -o $(TARGET) $(OBJS) $(DLOBJS) $(LIBS)

install : all
	-mv $(SERVERDIR)/$(TARGET) $(SERVERDIR)/$(TARGET).old
	$(INSTALL) -c $(TARGET) $(SERVERDIR)
	$(INSTALL) -c gopherd.conf $(SERVERDIR)
	-rm	$(SERVERDIR)/gopherls $(SERVERDIR)/gindexd
	-ln     -s $(SERVERDIR)/$(TARGET) $(SERVERDIR)/gopherls
	-ln     -s $(SERVERDIR)/$(TARGET) $(SERVERDIR)/gindexd

clean:
	-rm -f $(TARGET) $(OBJS) $(NEXTOBJ) *.out *~ core

