#
# Top level make of the WAIS system
#   brewster 2/91
#   jonathan 6/91
#   warnock@clark.net 8/94
#
# $Log: Makefile-release,v $
# Revision 1.8  92/05/07  15:54:08  jonathan
# Updated for release.
# 
# Revision 1.7  92/03/26  18:29:59  jonathan
# Fixed some broken make lines.
# 
# Revision 1.6  92/03/07  19:45:01  jonathan
# Added recommendation for IBM.
# 
# Revision 1.5  92/02/27  10:07:24  jonathan
# got rid of automatic setting of TOP.  Used Simon's approach instead.
# 
# Revision 1.4  92/02/13  12:27:53  jonathan
# Removed references to seeker.
# 
# Revision 1.3  92/02/13  12:05:17  jonathan
# Removed release targets.
# 
# Revision 1.2  92/02/13  11:57:56  jonathan
# Added $Log for RCS.
#
# There are a whole bunch of options you can set in the CFLAGS in the
# system makefiles.  Here's an overview:
#
# For a little better security in the server, add -DSECURE_SERVER
#   this sets the server user id to -u argument after startup.
# for relevance feedback in the search engine, add -DRELEVANCE_FEEDBACK
#
#   dgg additions
# -DLITERAL == waisserver, search for "literal strings"
# -DBOOLEANS == waisserver, search with boolean AND, NOT operators
# -DPARTIALWORD == waisserver, search for partial words, hum* matches human, 
#   hummingbird, ...
# -DBIO == waisindex, waisserver changes including symbol indexing & search 
#   & bio data formats
#
# -DTELL_USER lets the server know who you are at connect time
# -DUSE_SYSLOG if you want logging to be done with syslog rather than
#   fprintf
# -DNEED_VSYSLOG if your C library does not have a vsyslog() function
#   in it (and you defined USE_SYSLOG)
# -DDUMPCORE will force the waisserver to dump the core when aborting
#   otherwise the core will not be dumped
# -DEND_MERGE if you want to merge the index files at the end of an
#   index process otherwise they are merged as we go along
# -DSTEM_WORDS to stem words during indexing and queries
# -DBIGINDEX if you need to index a large number of documents (but
#   you'll have to reindex all your existing databases, too)
# -DNEEDMALLOC if your system doesn't have a prototype for malloc
# -DNEEDSTRCPY if your system doesn't have a prototype for strcpy
# -DNEED8BIT if you want to take a chance on using 8-bit characters
#   for word delimiters (see src/ir/irtfiles.c)
#
# Special Document Types added
# -DMARC_TAG for ASCII files with US MARC tags
# -DAAS for American Astronomical Society AASTeX abstracts
# -DSTELAR for NASA's STELAR/RECON abstracts
# -DMD_DIF for NASA's Global Change Master Directory Interchange Format (DIF)
#
# Note - the default Porter Stemmer removes trailing e's from words -
# variable becomes variabl  - this can impact the use of literals in
# searches!!!!!!!!!!
#
# -DLIST_STEMS to show stemmed words in server log and indexer output

VERSION = 0.5
RELEASE = freeWAIS-$(VERSION)

RM	= /bin/rm
MV	= mv
MAKE	= make

#
# Directory definitions
#
# set this for your site.  This syntax only works in SunOS
# for other UNIX-like OS's set this to this directory.
#TOP:sh = pwd
# or fill in the blank for other OS's
#comment-me:
#	@echo You must set "\$$(TOP)" to point to the freeWAIS src directory

SRCDIR		= $(TOP)/src

RMFLAGS	= -f
MFLAGS	= -k

#
# Targets to build
default: 
	@echo "You have to specify which system to build for."
	@echo "Say 'make <system>', where <system> is one of the following:"
	@echo "aix, bsdi, dynix, hpux, irix-cc, irix-gcc, linux, osf,"
	@echo "solaris, sunos, ultrix-cc or ultrix-gcc"

all:
	@echo "You have to specify which system to build for."
	@echo "Say 'make <system>', where <system> is one of the following:"
	@echo "aix, bsdi, dynix, hpux, irix-cc, irix-gcc, linux, osf,"
	@echo "solaris, sunos, ultrix-cc or ultrix-gcc"

aix::
	$(MAKE) -f Makefile.aix TOP=$(TOP)
	touch $(TOP)/$(RELEASE)
	@echo "Welcome to freeWAIS version $(VERSION)"

bsdi::
	$(MAKE) -f Makefile.bsdi TOP=$(TOP)
	touch $(TOP)/$(RELEASE)
	@echo "Welcome to freeWAIS version $(VERSION)"

dynix::
	$(MAKE) -f Makefile.dynix TOP=$(TOP)
	touch $(TOP)/$(RELEASE)
	@echo "Welcome to freeWAIS version $(VERSION)"

hpux::
	$(MAKE) -f Makefile.hpux TOP=$(TOP)
	touch $(TOP)/$(RELEASE)
	@echo "Welcome to freeWAIS version $(VERSION)"

irix-cc::
	$(MAKE) -f Makefile.irix-cc TOP=$(TOP)
	touch $(TOP)/$(RELEASE)
	@echo "Welcome to freeWAIS version $(VERSION)"

irix-gcc::
	$(MAKE) -f Makefile.irix-gcc TOP=$(TOP)
	touch $(TOP)/$(RELEASE)
	@echo "Welcome to freeWAIS version $(VERSION)"

linux::
	$(MAKE) -f Makefile.linux TOP=$(TOP)
	touch $(TOP)/$(RELEASE)
	@echo "Welcome to freeWAIS version $(VERSION)"

osf::
	$(MAKE) -f Makefile.osf TOP=$(TOP)
	touch $(TOP)/$(RELEASE)
	@echo "Welcome to freeWAIS version $(VERSION)"

solaris::
	$(MAKE) -f Makefile.solaris TOP=$(TOP)
	touch $(TOP)/$(RELEASE)
	@echo "Welcome to freeWAIS version $(VERSION)"

sunos::
	$(MAKE) -f Makefile.sunos TOP=$(TOP)
	touch $(TOP)/$(RELEASE)
	@echo "Welcome to freeWAIS version $(VERSION)"

ultrix-cc::
	$(MAKE) -f Makefile.ultrix-cc TOP=$(TOP)
	touch $(TOP)/$(RELEASE)
	@echo "Welcome to freeWAIS version $(VERSION)"

ultrix-gcc::
	$(MAKE) -f Makefile.ultrix-gcc TOP=$(TOP)
	touch $(TOP)/$(RELEASE)
	@echo "Welcome to freeWAIS version $(VERSION)"

test::
	@echo $(MAKE) CC=$(CC) CFLAGS="$(CFLAGS)" TOP=$(TOP)

check::
	cd wais-test; $(MAKE)

# to make the emacs tags table for meta-.:
tags:   
	etags -f TAGS include/*.[ch]
	etags -af TAGS $(SRCDIR)/ir/*.[ch]
	etags -af TAGS $(SRCDIR)/indexer/*.[ch]
	etags -af TAGS $(SRCDIR)/server/*.[ch]
	etags -af TAGS $(SRCDIR)/client/ui/*.[ch]
	etags -af TAGS $(SRCDIR)/client/swais/*.[ch]
	etags -af TAGS $(SRCDIR)/client/waisq/*.[ch]
	etags -af TAGS $(SRCDIR)/client/waissearch/*.[ch]
	etags -af TAGS $(SRCDIR)/client/x/*.[ch]
	etags -af TAGS lib/*.[ch]

# Remove objects and library.
clean:
	$(RM) $(RMFLAGS) $(TOP)/$(RELEASE)
	$(RM) $(RMFLAGS) *%
	$(RM) $(RMFLAGS) *~
	$(RM) $(RMFLAGS) \#*\#
	$(RM) $(RMFLAGS) core
	$(RM) $(RMFLAGS) TAGS
	$(RM) $(RMFLAGS) -r SearchLog
	$(RM) $(RMFLAGS) wais-sources/wais-docs*
	$(RM) $(RMFLAGS) config config.h ./include/config.h
	cd lib; make $@ TOP=$(TOP) RM=$(RM) RMFLAGS=$(RMFLAGS)
	cd src; make $@ TOP=$(TOP) RM=$(RM) RMFLAGS=$(RMFLAGS)
	cd bin; make $@ TOP=$(TOP) RM=$(RM) RMFLAGS=$(RMFLAGS)
	cd doc; make $@ TOP=$(TOP) RM=$(RM) RMFLAGS=$(RMFLAGS)
	cd man; make $@ TOP=$(TOP) RM=$(RM) RMFLAGS=$(RMFLAGS)
	cd include; make $@ TOP=$(TOP) RM=$(RM) RMFLAGS=$(RMFLAGS)
	cd wais-test; make $@ TOP=$(TOP)
	cd wais-sources; make $@ TOP=$(TOP)

rlocks:
	$@
	cd lib; $@
	cd src; $@
	cd bin; $@
	cd doc; $@
