# Master makefile for Heisenberg --- this makefile builds both
#   the graphics part and the Mathematica part of Heisenberg

# USE THIS MAKEFILE ONLY IF YOUR GRAPHICS HOST AND MATHEMATICA HOST
# ARE THE SAME, OR ARE THE SAME TYPE OF COMPUTER AND SHARE THE SAME
# FILESYSTEM.  FOR MORE INFO ON INSTALLING HEISENBERG, SEE THE README
# FILE IN THIS DIRECTORY.

####################################################################
# 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=/u/mbp/Heisenberg

# CP = copying command to use when installing files ('cp' or 'ln')
CP=ln

# BINDIR = directory in which you want to install the executable files
BINDIR=$(PWD)/bin

# OPTIONS = Compiler options
OPTIONS=-O

# AUXDIR = complete pathname of directory in which you want to install
# the files that Heisenberg needs at run-time.  Do not move or delete
# these files; if you do, Heisenberg will not work any more.  Do not
# comment out the def of AUXDIR; if you do, Heisenberg will not work
# then either.
AUXDIR = $(PWD)/lib

# 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 = bsd/

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

# SPOOL_COMMAND = command to use for printing PostScript files.  If
# you can't print PostScript files, comment out this def.
SPOOL_COMMAND=lpr

# DEV = the kind of graphics device to compile for; should be
#    DEV = SUNVIEW
# for Suns, or
#    DEV = IRIS4
# for IRISes.
DEV = IRIS4

# MATHDIR = pathname on your Mathematica host of the Mathematica root dir.
# This is the dir containing the subdirs Bin.*, Init, Packages, etc.
MATHDIR = /u/src/mathematica/version1.2/iris_4d120/

# 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.Iris

# End of Configuration section
####################################################################

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

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

INSTALL_BIN = $(PWD)/instl

INSTALL = $(INSTALL_BIN) -cp "$(CP)"

SHELL = /bin/sh

MAKE_ARGS = \
  CP="$(CP)" \
  BINDIR="$(BINDIR)" \
  OPTIONS="$(OPTIONS)" \
  AUXDIR="$(AUXDIR)" \
  BSDPREFIX="$(BSDPREFIX)" \
  BSDLIBS="$(BSDLIBS)" \
  SPOOL_COMMAND="$(SPOOL_COMMAND)" \
  DEV="$(DEV)" \
  MATHDIR="$(MATHDIR)" \
  MACHDIR="$(MACHDIR)" \
  HEISENBERGPATH="$(HEISENBERGPATH)" \
  ELBOWDPATH="$(ELBOWDPATH)"

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

warning:
	@echo ''
	@echo 'You may only use this Makefile if your graphics host'
	@echo 'and Mathematica host are the same, or are the same type'
	@echo 'of computer and share a filesystem.  If you are sure'
	@echo 'that this is the case, type "make install" to perform the'
	@echo 'installtion.'
	@echo ''
	@echo 'For more information on installing Heisenberg, and for'
	@echo 'instructions on running it, see the README file in this'
	@echo 'directory.'
	@echo ''

all:	compile_math compile_graphics

install:	install_math install_graphics
	@echo ''
	@echo 'Heisenberg installation is now complete.  The executable files'
	@echo 'for both the graphics host and the Mathematica host are in'
	@echo 'the directory'
	@echo '     $(BINDIR)'
	@echo ''

compile_math:
	cd Mathematica ; \
	  $(MAKE) \
	    PWD="$(PWD)/Mathematica" \
	    $(MAKE_ARGS)

install_math:
	cd Mathematica ; \
	  $(MAKE) \
	    PWD="$(PWD)/Mathematica" \
	    $(MAKE_ARGS) \
	    install_quietly

compile_graphics:
	cd graphics ; \
	  $(MAKE) \
	    PWD="$(PWD)/graphics" \
	    $(MAKE_ARGS)

install_graphics:
	cd graphics ; \
	  $(MAKE) \
	    PWD="$(PWD)/graphics" \
	    $(MAKE_ARGS) \
	    install_quietly

heisenberg.tar.Z:	heisenberg.tar
	compress heisenberg.tar

heisenberg.tar:	rm-heisenberg.tar
	tar chbf 512 /tmp/heisenberg.tar *
	/bin/mv /tmp/heisenberg.tar .

rm-heisenberg.tar:
	/bin/rm -f heisenberg.tar ;

kits:
	/bin/rm -f MANIFEST
	find . -print | \
	makekit -oMANIFEST -t"Now read the INSTRUCTIONS file." \
	    -n"heisenberg.shar." -s40k

localclean:
	/bin/rm -f *~ ;

clean:	localclean
	cd graphics ; $(MAKE) clean
	cd Mathematica ; $(MAKE) clean

veryclean:	localclean
	cd graphics ; $(MAKE) veryclean
	cd Mathematica ; $(MAKE) veryclean

distclean:	localclean
	/bin/rm -r -f ./bin ./lib
	cd graphics ; $(MAKE) distclean
	cd Mathematica ; $(MAKE) distclean

