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

# Master makefile for Mathematica part of link

####################################################################
# 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'.  By default (as this Makefile is distributed),
# executables are placed in a subdir of this dir called 'bin'.  If you
# want to put them somewhere else, change the def here, preferably to
# a dir which is on your search path.
BINDIR = $(PWD)/bin

# OPTIONS = compiler options
OPTIONS=-O

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

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

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

INSTALL_BIN = $(PWD)/../instl

HYPERMATHPATH = $(BINDIR)/HyperMath

HYPERPACKAGEPATH = $(PWD)/Packages

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

SHELL = /bin/sh

MATHPIPE_MAKE_OPTIONS =  \
  PWD="$(PWD)/mathpipe"  \
  OPTIONS="$(OPTIONS)"  \
  BINDIR="$(BINDIR)"  \
  CP="$(CP)"  \
  INSTALL_BIN="$(INSTALL_BIN)" \
  BOTHPIPEDIR="$(PWD)/bothpipe" \
  SYS_TYPES_H="<$(BSDPREFIX)sys/types.h>" \
  SYS_SOCKET_H="<$(BSDPREFIX)sys/socket.h>" \
  NETINET_IN_H="<$(BSDPREFIX)netinet/in.h>" \
  NETDB_H="<$(BSDPREFIX)netdb.h>" \
  STRINGS_H="<$(BSDPREFIX)strings.h>" \
  LIBS="$(BSDLIBS)"

PACKAGES_MAKE_OPTIONS = \
  MATHPIPEPATH="$(BINDIR)/mathpipe"

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

all:	compile_mathpipe compile_packages

compile_mathpipe:
	cd mathpipe ;				\
	$(MAKE)					\
	  $(MATHPIPE_MAKE_OPTIONS)

compile_packages:
	cd Packages ;			\
	$(MAKE)				\
	  $(PACKAGES_MAKE_OPTIONS)

install:	$(BINDIR) install_mathpipe install_packages

$(BINDIR):
	mkdir $(BINDIR)

install_mathpipe:
	cd mathpipe ;				\
	$(MAKE)					\
	  $(MATHPIPE_MAKE_OPTIONS)		\
	  install

install_packages:
	cd Packages ;				\
	$(MAKE)					\
	  $(PACKAGES_MAKE_OPTIONS)		\
	  install

localclean:
	/bin/rm -f *~ ;

clean:	localclean
	cd mathpipe ; $(MAKE) clean
	cd Packages ; $(MAKE) clean

veryclean:	localclean
	cd mathpipe ; $(MAKE) veryclean
	cd Packages ; $(MAKE) veryclean

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