#=====================================================================
# The following values are patched by "configure" and "setup" or may be 
# adjusted manually
# =====================================================================

ARCH=sun4
LispDir=

# =====================================================================
# MACROS:
#
# LispType     = the type of the lisp system used to build HOL. 
#                Possibilities are cl (for Common Lisp) or franz 
#                (for Franz Lisp).
#
# Obj          = the default filename extension for compiled lisp files.
#                for Franz Lisp this is o; for Common Lisp this depends on
#                the implementation. Some implementations and values are:
#
#                   Lucid CL     lbin
#                   KCL, AKCL    o
#                   Allegro CL   fasl
#
# Lisp         = the lisp system used to build HOL.  This can be 
# 		 an absolute pathname, a relative pathname, or simply
#		 the name of the appropriate shell command (e.g. "lisp")
#                provided this can be found by following the builder's 
#                unix search path.
# 
# Liszt        = the franz lisp complier used to build HOL.  This can be 
#	 	 an absolute pathname, a relative pathname, or simply
#		 the name of the appropriate shell command (e.g. "liszt")
#                provided this can be found by following the builder's 
#                unix search path. This macro is relevant only for
#	         building a Franz Lisp version of HOL.
#
# LisztComm    = the command issued (internally) by HOL to call the 
#		 lisp compiler when compiling ML.  This can be just 
#		 "liszt", if liszt will be found by following the HOL 
#		 user's search path. An absolute pathname can also be 
#		 nused for LisztComm. This macro is relevant onlt
#                for building a Franz Lisp version of HOL.
#
# Allegro      = Option for case-sensitivity in any version of Allegro
#                common lisp.
#
# AllegroV4.0  =  Allegro 4.0 specials
#
# AllegroV4.1  = Allegro 4.1 specials
#
#
# AllegroStuff = Combinations of options for any given version of
#                Allegro common lisp.
#
# LispDir      = the directory where the Lisp sources are
#               (used for Library/eval and Library/prog_logic88)
#
# =====================================================================

# *********************************************************************
# To install HOL, edit the following definitions of:
#     LispType, Obj, Lisp, Liszt, LisztComm, and HOLdir 
# *********************************************************************

SHELL=/bin/sh

LispType=cl
Obj=o
Lisp=akcl
Liszt=
LisztComm=
Allegro=(set-case-mode :case-insensitive-upper)
AllegroV4.0= $(Allegro) (setq *cltl1-in-package-compatibility-p* t) (setq comp:*cltl1-compile-file-toplevel-compatibility-p* t)

AllegroV4.1= $(AllegroV4.0) (setq *enable-package-locked-errors* nil)
AllegroStuff= (progn () $(AllegroV4.1))

HolLispBasic=lisp/f-$(LispType).$(Obj)

default: all

all: hol88 hol90

hol88: lisp/$(ARCH)/hol-tcl-writ.$(Obj) lisp/$(ARCH)/f-tcl-format.$(Obj)

hol90:

clean:
	/bin/rm -f lisp/*.$(Obj)
	@echo "=======> all lisp object code deleted"

lisp/%.$(Obj): $(LispDir)/%.$(Obj)
	ln -s $< lisp/$*.$(Obj)


lisp/$(ARCH)/hol-tcl-writ.$(Obj): lisp/hol-tcl-writ.l lisp/f-constants.$(Obj)\
	              lisp/f-macro.$(Obj) lisp/f-ol-rec.$(Obj)\
	              lisp/genmacs.$(Obj) $(HolLispBasic)
	if [ $(LispType) = cl ]; then\
	  echo '#+allegro $(AllegroStuff)'\
	       '(load "lisp/f-cl") (compile-file "lisp/hol-tcl-writ.l") (quit)'\
	       | $(Lisp); else\
	  $(Liszt) lisp/hol-tcl-writ; fi
	-mkdir lisp/$(ARCH)
	mv lisp/hol-tcl-writ.$(Obj) $@

lisp/$(ARCH)/f-tcl-format.$(Obj): lisp/f-tcl-format.l lisp/f-macro.$(Obj)\
		lisp/f-constants.$(Obj) $(HolLispBasic)
	if [ $(LispType) = cl ]; then\
	          echo '#+allegro $(AllegroStuff)'\
	               '(load "lisp/f-cl") (compile-file "lisp/f-tcl-format.l") (quit)'\
	               | $(Lisp); else\
	          $(Liszt) lisp/f-tcl-format; fi
	-mkdir lisp/$(ARCH)
	mv lisp/f-tcl-format.$(Obj) $@


