# $Id: Makefile,v 4.0 89/06/06 15:38:22 mbp Exp $

# Makefile for heisenberg

# 1. Copying operation to use during installation.  Use cp to copy, or ln
#    to make links:
CP=ln

# 2. This line must be hard coded if not using csh; no trailing space!
#    Remove the comment at the begining of the next line if you are
#    not using csh and set the path to the path of the dir that the 
#    Heisenberg source code is in:
#PWD=/usr/yourlogin/src/gr

# 3. This line should define any additional options you want to pass to 
#    the cc command, such as -g, -O, etc:
OPTIONS=-O

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

# 4. This line should give the complete pathname of the
#    directory in which you want to put the file 'heisenberg.hlp'.
#    This file is needed at run-time, so pick a permanet location.
#    The Makefile will copy heisenberg.hlp to this directory when you
#    do 'make install'; it will create this dir if it does not yet
#    exist.
HELPDIR=$(HOME)/lib/heisenberg

# 5. BINDIR should be the pathname of the dir where you want to install
#    the executable file 'heisenberg'.
BINDIR=$(HOME)/bin/$(CPUTYPE)

# 6. This line should give the dir that the file "gr.h" is in:
GR_DIR=$(HOME)/lib/gr

# 7. This line should give the dir that the file "lgd.h" is in:
LGD_DIR=$(HOME)/lib/lgd

# 8. This line should give the pathname of the GR library libgr3d.a:
GR3D_LIB=$(HOME)/lib/$(CPUTYPE)/libgr3d.a

# 9. This line should give the pathname of the LGD library liblgd.a:
LGD_LIB=$(HOME)/lib/$(CPUTYPE)/liblgd.a

#10. This line should give the pathname of the FSA object file FSA_OBJ:
FSA_OBJ=$(HOME)/lib/$(CPUTYPE)/fsa.o

#11. This line should be
#	DEVICE=-DDEVICE_SUNVIEW
#    for the SunView version, or
#	DEVICE=-DDEVICE_IRIS
#    for the IRIS version:
DEVICE=-DDEVICE_IRIS

# 12. LIBS should be the list of libraries to link in.
# On sun, use
#   LIBS = $(LGD_LIB) $(GR3D_LIB) -lm -lsuntool -lsunwindow -lpixrect
# On iris, use
#   LIBS = $(LGD_LIB) -lm
LIBS = $(LGD_LIB) -lm -lgl_s

# 13. If your /usr/include/math.h has a declaration for acosh, 
# the following should be
#   HAVE_ACOSH_DEC=-DHAVE_ACOSH_DEC
# If it doesn't have an acosh declaration, comment this definition out.
HAVE_ACOSH_DEC=-DHAVE_ACOSH_DEC

####################################################################
#  Nothing below here should need to be changed                    #

SHELL=/bin/sh

HELPFILE=$(HELPDIR)/heisenberg.hlp
CFLAGS=$(OPTIONS) $(DEVICE) -I$(GR_DIR) -I$(LGD_DIR)
OBJS = 		heisenberg.o draw.o complex.o complex_math.o convert.o \
		matrix.o misc_math.o transf_math.o surface.o
SURFACE_OBJS =	hsurface.o surface.o complex.o misc_math.o globals.o \
		convert.o complex_math.o matrix.o transf_math.o


MAKEFILE = Makefile

INSTALL_BIN = instl

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

MACRO_DEFS = $(HAVE_ACOSH_DEC)

COMPILE = cc -c $(CFLAGS) $(MACRO_DEFS)

all:	heisenberg heisenberg.hlp

install:	install_bin install_help
	
install_help:	heisenberg.hlp
	$(INSTALL) -mkdir '$(HELPDIR)' heisenberg.hlp

install_bin:	heisenberg
	strip heisenberg
	$(INSTALL) '$(BINDIR)' heisenberg

heisenberg:		$(OBJS)
	cc $(CFLAGS) \
	   -o heisenberg $(OBJS) \
	   $(FSA_OBJ) \
	   $(LIBS)

heisenberg.o:		heisenberg.c heisenberg.h
	$(COMPILE) -DHELPFILE='"$(HELPFILE)"' -o heisenberg.o heisenberg.c

hsurface:	$(SURFACE_OBJS)
	cc $(CFLAGS) -o hsurface $(SURFACE_OBJS) \
	  $(FSA.o) -lm

globals.o:	globals.c heisenberg.h
	cc -c $(CFLAGS) -o globals.o globals.c

surface.o:	surface.c heisenberg.h
	cc -c $(CFLAGS) -o surface.o surface.c

hsurface.o:	hsurface.c heisenberg.h
	cc -c $(CFLAGS) -o hsurface.o hsurface.c


draw.o:		draw.c heisenberg.h
	$(COMPILE) -o draw.o draw.c

complex.o:	complex.c complex.h
	$(COMPILE) -o complex.o complex.c

complex_math.o:	complex_math.c heisenberg.h
	$(COMPILE) -o complex_math.o complex_math.c

convert.o:	convert.c heisenberg.h
	$(COMPILE) -o convert.o convert.c

matrix.o:	matrix.c matrix.h matrixentry.h
	$(COMPILE) -o matrix.o matrix.c

misc_math.o:	misc_math.c heisenberg.h
	$(COMPILE) -o misc_math.o misc_math.c

transf_math.o:	transf_math.c heisenberg.h
	$(COMPILE) -o transf_math.o transf_math.c

matrixentry.h:	complex.h
	touch matrixentry.h

heisenberg.h:	complex.h datatypes.h
	touch heisenberg.h

clipper:	clipper.c
	cc -g -o clipper clipper.c

lint:
	lint *.c

heisenberg.hlp:		heisenberg.nr
	/bin/rm -f heisenberg.hlp
	nroff heisenberg.nr > heisenberg.hlp

clean:
	/bin/rm -f *~ *.o *%

veryclean:
	/bin/rm -f *~ *.o *% heisenberg *.hlp

distclean:	veryclean

tri2vec:	tri2vec.c
	cc -g -o tri2vec tri2vec.c
