# Makefile for installing CLISP

# -------------- Start of configurable section --------------------

# Directories used by "make install":
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
mandir = $(exec_prefix)/man
libdir = $(exec_prefix)/lib
lisplibdir = $(libdir)/lisp

# Programs used by "make":
CC = cc

# Programs used by "make install":
INSTALL = cp
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL)

# -------------- End of configurable section --------------------

SHELL = /bin/sh

all : lisp.run

lisp.run : lisp.a libreadline.a
	$(CC) lisp.a libreadline.a -ltermcap -o lisp.run
	strip lisp.run

install : install-bin install-man

install-bin : lisp.run lispinit.mem force
	if [ ! -d $(libdir) ] ; then mkdir $(libdir) ; fi
	if [ ! -d $(lisplibdir) ] ; then mkdir $(lisplibdir) ; fi
	$(INSTALL_PROGRAM) lisp.run $(lisplibdir)/lisp.run
	$(INSTALL_DATA) lispinit.mem $(lisplibdir)/lispinit.mem
	if [ ! -d $(bindir) ] ; then mkdir $(bindir) ; fi
	(echo '#!/bin/sh' ; echo 'exec $(lisplibdir)/lisp.run -M $(lisplibdir)/lispinit.mem "$$@"') > $(bindir)/clisp
	chmod a+x $(bindir)/clisp

install-man : clisp.1 force
	if [ ! -d $(mandir) ] ; then mkdir $(mandir) ; fi
	if [ ! -d $(mandir)/man1 ] ; then mkdir $(mandir)/man1 ; fi
	$(INSTALL_DATA) clisp.1 $(mandir)/man1/clisp.1

force:

