# Makefile for most pager   -*- sh -*-

# This file is divided into several sections.  The first few sections deal 
# with choosing a compiler, etc...  The last few sections are only needed if
# you have the slang library.  This library is freely available from 
# space.mit.edu in pub/davis/slang.  Using this library gives MOST the 
# ability to use regular expression searches as well as user definable 
# keymaps.  Future versions of MOST may require the library.


#---------------------------------------------------------------------------
# 1. C Compiler.
#---------------------------------------------------------------------------
CC = cc  -O -Dunix                              # Other unix systems
#CC = gcc -O1 -traditional-cpp                   # SunOS
#CC = acc -Xa -vc -O                             # SunOS with acc
#CC = gcc -g -Wall -Wstrict-prototypes          # Linux

#---------------------------------------------------------------------------
# 2. Termcap or Terminfo?  Uncomment one.
#---------------------------------------------------------------------------
TERMCAP = termcap
#TERMCAP = curses
#TERMCAP = terminfo

#---------------------------------------------------------------------------
# 3.  Online help configuration
#---------------------------------------------------------------------------
# If you want MOST to read a file for online help instead of the builtin
# help screen, then you have two alternatives:
#
#  1. Pointing the environment variable MOST_HELP to a help file.
#  2. Compile in the location of a help file:
#        -DMOST_HELPFILE=\"help-file-name\"
# Choosing neither of these results in the use of the built-in help screen.
#MOST_HELP_FILE = -DMOST_HELPFILE=\"/usr/local/lib/most/most.doc\"

#--------------------------------------------------------------------------
# 4. Installation options used by 'make install'
#--------------------------------------------------------------------------
BINDIR = /usr/local/bin
MANDIR = /usr/local/man
MANSECT = 1
MANPATH = $(MANDIR)/man$(MANSECT)
INSTALL = install
RM = /bin/rm -f

#  (The next few sections are only valid if you have the slang library.)

#---------------------------------------------------------------------------
# 5.  If you have the slang library, uncomment the next four lines and and
#     modify the first one to point to the location of libslang.a
#---------------------------------------------------------------------------
#SLINCLUDE = ../slang/src
#SLFLAGS = -DUSE_SLANG
#SLIB = -L$(SLINCLUDE) -lslang
#SLINC = -I$(SLINCLUDE)

#---------------------------------------------------------------------------
# Regular expression searches?  Uncomment to enable.
#---------------------------------------------------------------------------
#REGEXP_TYPE = -DSLANG_REGEXP

#---------------------------------------------------------------------------
# Nothing below here should require changing.

OBJS = main.o buffer.o file.o window.o line.o display.o keyparse.o\
          sysdep.o keym.o most.o search.o help.o cmd.o edit.o

EXEC = most

ALLFLAGS = $(CFLAGS) $(SLFLAGS) $(SLINC) $(MOST_HELP_FILE) $(REGEXP_TYPE)

.c.o:
	$(CC) -c $(ALLFLAGS) $*.c

$(EXEC): $(OBJS)
	$(CC) $(OBJS) -o $(EXEC) $(SLIB) -l$(TERMCAP)


most.doc:	most.1
		nroff -man $? > $@


clean:
	$(RM) *~ *.o most files.pck typescript 
 
install: most most.doc
	$(INSTALL) -m 644 most.1 $(MANPATH)
	$(INSTALL) -m 755 most $(BINDIR)



