# $Id: Makefile,v 1.2 90/07/11 13:07:31 mbp Exp Locker: mbp $

# Master makefile for Mathematica part of Hypercad and Interface

####################################################################
# Configuration section

# PWD = complete pathname of the dir containing this makefile.  If you
# are using csh this should be set automatically by the shell.
# Otherwise, remove the comment char from the next line and append the
# pathname of this dir.
# PWD = 

# BINDIR = dir in which to install executable files. This is used by
# 'make install'.  If this def is left blank or commented out, the
# executables will be left in their source dirs.
BINDIR = $(PWD)/bin

# OPTIONS = compiler options
OPTIONS=-O

# CP = copying command for use in installation. Should be 'ln' or 'cp'.
CP=ln

# ELBOWDPATH = pathname, on graphics host, of executable file
# 'elbowd'.  This is used only by the Hypercad shell script.
ELBOWDPATH = $(BINDIR)/elbowd

# HGRAPHICSPATH = pathname, on graphics host, of executable file
# 'hgraphics'.  This is used only by the Hypercad shell script.
HGRAPHICSPATH = $(BINDIR)/hgraphics

# MATHDIR = pathname of the mathematica root dir on your system.
# This is the dir containing the subdirs Bin.*, Init, Packages, etc.
MATHDIR = /Lakisis/usr/local/lib/math2

# MACHDIR = name of the subdirectory of the Mathematica root dir
# containing the Mathematica executable file 'mathexe'.  Use
# 	MACHDIR = Bin.sun3 	(for Sun 3's)
#   or	MACHDIR = Bin.sun4	(for Sun 4's)
#   or	MACHDIR = Bin.Iris 	(for IRISes)
# etc.
MACHDIR = Bin.sun3

# BSDPREFIX = prefix for "BSD style" header files sys/types.h,
# sys/socket.h, netinet/in.h, netdb.h, and strings.h.  On Suns and other
# Berkeley Unix systems, leave the def of BSDPREFIX commented out.  On
# IRISes it should be
#   BSDPREFIX = bsd/
# (the last thing on the line should be the '/' --- no trailing blanks!)
# BSDPREFIX = 

# BSDLIBS = any library flags which are necessary to load the BSD
# libraries.  On Suns and other Berkeley Unix systems, leave the def
# of BSDPREFIX commented out.  On IRISes it should be
#   BSDLIBS = -lbsd
# BSDLIBS = 

# End configuration section --- don't change anything below here
####################################################################

INSTALL_BIN = $(PWD)/instl

MAKE_OPTIONS = \
  BINDIR="$(BINDIR)" \
  OPTIONS="$(OPTIONS)" \
  CP="$(CP)" \
  ELBOWDPATH="$(ELBOWDPATH)" \
  HGRAPHICSPATH="$(HGRAPHICSPATH)" \
  MATHDIR="$(MATHDIR)" \
  MACHDIR="$(MACHDIR)" \
  INSTALL_BIN="$(INSTALL_BIN)" \
  BSDPREFIX="$(BSDPREFIX)" \
  BSDLIBS="$(BSDLIBS)"

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

all:	compile_hypercad compile_interface

compile_hypercad:
	cd Hypercad ; \
	$(MAKE) \
	  PWD="$(PWD)/Hypercad" \
	  $(MAKE_OPTIONS)

compile_interface:
	cd Interface ; \
	$(MAKE) \
	  PWD="$(PWD)/Interface" \
	  $(MAKE_OPTIONS)

install_quietly:	$(BINDIR) install_hypercad install_interface

install:	install_quietly
	@echo ''
	@echo 'Installation of the Mathematica part of Hypercad is now'
	@echo 'complete. The executable files for the Mathematica host'
	@echo 'are in the directory'
	@echo '     $(BINDIR)'
	@echo ''

$(BINDIR):
	mkdir $(BINDIR)

install_hypercad:
	cd Hypercad ; \
	$(MAKE) \
	  PWD="$(PWD)/Hypercad" \
	  $(MAKE_OPTIONS) \
	  install

install_interface:
	cd Interface ; \
	$(MAKE) \
	  PWD="$(PWD)/Interface" \
	  $(MAKE_OPTIONS) \
	  install

localclean:
	/bin/rm -f *~ ;

clean:		localclean
	cd Hypercad ; $(MAKE) clean
	cd Interface; $(MAKE) clean

veryclean:		localclean
	cd Hypercad ; $(MAKE) veryclean
	cd Interface; $(MAKE) veryclean

distclean:		localclean
	/bin/rm -r -f ./bin
	cd Hypercad ; $(MAKE) distclean
	cd Interface; $(MAKE) distclean

