# Makefile for Surface Evolver
SHELL= /bin/sh

# INSTRUCTIONS: Customize this makefile for your system by choosing
# your compiler (cc or gcc or whatever), and then uncomment the
# appropriate CFLAGS, GRAPH, and GRAPHLIB definitions for your system.
# If lines need to be modified for your system, please let me know
# at brakke@susqu.edu.

# NOTE: -DOOGL should be specified in CFLAGS if you want Evolver to 
# be able to use geomview.  And -DOOGL is harmless in any case. 

# Pick your compiler, and add any options you want, such as optimization
CC= cc 
#CC= gcc

# Remove #'s from following 3 lines for generic Unix without builtin graphics.
# Add -DOOGL to CFLAGS if you are using geomview.
#CFLAGS= -DGENERIC
#GRAPH= nulgraph.o 
#GRAPHLIB= 

# Remove #'s from following 3 lines for generic Unix with X-windows. 
# Add -DOOGL to CFLAGS if you are using geomview.
#CFLAGS= -DGENERIC
#GRAPH= xgraph.o 
#GRAPHLIB= -lX11 
#some places might have -lX11-mit

# Remove #'s from following 3 lines for LINUX with OpenGL GLUT graphics.
# The graphics are on a second thread, so pthreads are needed.
# -DREADLINE, -lreadline, and -lcurses enable line editing at the command
# prompt; they may be deleted if they give you trouble.
# -DPTRHEADS is necessary with glutgraph.o.
#CFLAGS= -DLINUX -DOOGL -DREADLINE -DPTHREADS
#GRAPH= glutgraph.o 
#GRAPHLIB= -lreadline -lcurses -lGL -lGLU -lglut -lpthread

# Remove #'s from following 3 lines for LINUX with crummy Xwindows graphics.
# You may have to modify the X11 lib path given here.
# -DREADLINE, -lreadline, and -lcurses enable line editing at the command
# prompt; they may be deleted if they give you trouble.
#CFLAGS= -DLINUX -DOOGL -DREADLINE
#GRAPH= xgraph.o 
#GRAPHLIB= -L/usr/X11R6/lib -lX11 -lreadline -lcurses

# Remove #'s from following 5 lines for MAC OSX with OpenGL GLUT graphics.
#INC=/System/Library/Frameworks/GLUT.framework/Versions/A/Headers
#CFLAGS= -DLINUX -DPTHREADS -DOOGL -DMAC_OS_X -I$(INC)
#GRAPH= glutgraph.o
#GLDIR=/System/Library/Frameworks/OpenGL.framework/Libraries
#GRAPHLIB= -L$(GLDIR)  -lGL -lGLU -lobjc  -framework GLUT

# Remove #'s from following 3 lines for SUNs or SPARCSTATIONs with X-windows
# WARNING: If you use -O2 optimization, you may have to compile popfilm.c
# without optimization, because sun optimization may hang.
#CFLAGS= -DSUN -DOOGL -I/usr/openwin/include
#GRAPH= xgraph.o 
#GRAPHLIB= -L/usr/openwin/lib  -lX11 

# 32-bit SOLARIS with GLUT.  The GLUT graphics window runs in a separate
# thread;  -DPTHREADS enables threads in Evolver source code, and -pthreads
# enables it in the gcc compiler.  For Solaris cc compiler, use -mt instead.
#GLUTHOME= /usr/local/sparc_solaris/glut-3.7
#INCLUDE= -I/usr/openwin/include -I$(GLUTHOME)/include
#CFLAGS= -DSUN -DOOGL -DGLUT -DPTHREADS -pthreads $(INCLUDE)
#GRAPH= glutgraph.o 
#GRAPHLIB= -L/usr/openwin/lib  -lX11 -L$(GLUTHOME)/lib/glut -lglut -lGL -lGLU -lXmu

# 64-bit SOLARIS with GLUT.  Also see 32 bit comments above.
#GLUTHOME= /usr/local/sparc_solaris_64bit/glut-3.7
#INCLUDE= -I/usr/openwin/include -I$(GLUTHOME)/include
#CFLAGS= -DSUN -DOOGL -DGLUT -DPTHREADS -pthreads $(INCLUDE) -m64 
#GRAPH= glutgraph.o 
#GRAPHLIB= -L/usr/openwin/lib  -lX11 -L$(GLUTHOME)/lib/glut -lglut -lGL -lGLU -lXmu

#Note on Solaris:
#SOLARISFLAGS= -L/usr/ucblib -lucb -R/usr/ucblib -lnsl -lsocket
#are needed for some programs on Solaris; but not this one -- they're poison
#for Evolver!

# Remove #'s from following 3 lines for DEC Alpha with X-windows 
# Add -DOOGL to CFLAGS if you have the X version of geomview.
#CFLAGS= -DDECALPHA -O -Olimit 2000
#GRAPH= xgraph.o
#GRAPHLIB= -lX11

# IRIX 4, with old gl graphics
# Remove #'s from the following three lines for Iris workstations with 
# geomview.  Those with R4000 CPUs or above may add -mips2 to CFLAGS.
#CFLAGS = -DIRIS -DOOGL -O2 -Olimit 3000 
#GRAPH= iriszgraph.o
#GRAPHLIB=  -lgl_s -lmalloc -lc_s

# IRIX 5
# Remove #'s from the following three lines for Iris workstations with 
# geomview.  Those with R4000 CPUs or above may add -mips2 to CFLAGS.
#CFLAGS = -DIRIS -DOOGL -O2 -Olimit 3000 
#GRAPH= xgraph.o
#GRAPHLIB=   -lmalloc -lX11

# IRIX 5, parallel
# Remove #'s from the following three lines for Iris workstations with 
# multiple processors and geomview.  OK for single processors, too.
# Those with R4000 CPUs or above may add -mips2 to CFLAGS.
#CFLAGS = -DIRIS -DOOGL -DSGI_MULTI -O2 -Olimit 3000 -mips2
#GRAPH= xgraph.o
#GRAPHLIB=   -lmalloc -lX11

# IRIX 6
# Remove #'s from the following three lines for Iris workstations with 
# IRIX 6.x operating system.  Add -DSGI_MULTI to CLFAGS if you
# have multiple processors.
#CFLAGS = -DIRIS -DOOGL -O2 -OPT:Olimit=6000
#GRAPH= xgraph.o
#GRAPHLIB=   -lmalloc -lX11


# Remove #'s from following 3 lines for  HP workstation
# Omit -Aa if you're using gcc
#CFLAGS= -Aa  -D_HPUX_SOURCE  -I/usr/include/X11R5
#GRAPH= xgraph.o
#GRAPHLIB= -L/usr/lib/X11R5 -lX11

# Remove #'s from following 3 lines for NeXTStep without screen graphics
# (see separate ftp archive evolver.next.tar.Z for graphics version)
#CFLAGS= -DNeXT
#GRAPH= nulgraph.o 
#GRAPHLIB= 

OBJ= calcforc.o  variable.o trirevis.o  stringl.o stringq.o model.o\
	 fixvol.o query.o matrix.o grapher.o painter.o filml.o filmq.o\
	 torvol.o lexinit.o graphgen.o modify.o userio.o boundary.o\
         curtest.o display.o yexparse.o lexyy.o ytab.o hessian.o\
	 evaltree.o cnstrnt.o verpopst.o popfilm.o machine.o veravg.o \
	 pixgraph.o tmain.o  tordup.o wulff.o help.o psgraph.o check.o  \
	 utility.o skeleton.o  storage.o dump.o iterate.o filgraph.o zoom.o\
         softimag.o mvgraph.o  diffuse.o sqcurve.o klein.o\
	 command.o hidim.o simplex.o metric.o torus.o quotient.o alice.o\
	 sdrv.o odrv.o userfunc.o kusner.o  simequi2.o\
	 geomgraph.o symtable.o exprint.o quantity.o meanint.o mindeg.o\
	 dodecGroup.o registry.o khyp.o gauss.o knot1.o eval_all.o\
	 lexinit2.o evalmore.o knot2.o knot3.o teix.o sqcurve2.o\
	 hessian2.o hessian3.o method1.o method2.o method3.o  bk.o\
	 method4.o eval_sec.o sqcurve3.o metis.o lagrange.o


evolver: makemark  $(OBJ)  $(GRAPH)
	$(CC) $(CFLAGS)  $(OBJ) $(GRAPH) $(GRAPHLIB) -o evolver -lm   

# This is to get global dependencies on the main header files.
makemark: skeleton.h storage.h model.h web.h
	rm *.o || true
	touch makemark

.c.o:
	$(CC) $(CFLAGS) -c  $<
 

# lexyy.c and ytab.c should only be remade when interface
# language is changed, which users shouldn't be touching.
#lexyy.c: datafile.lex express.h ytab.c lex.h
#	lex datafile.lex
#	sed '/#ident/d' <lex.yy.c >t.c
#	sed '/int \* p, int m/s/(int \* p, int m)/(p,m) int *p,m;/' <t.c >lexyy.c
#	rm lex.yy.c

#ytab.c:  command.yac  express.h
#	yacc -d command.yac
#	sed '/#ident/d' <y.tab.c >tmp.c
#	sed '/malloc()/d' <tmp.c >ytab.c
#	rm tmp.c
#	cp y.tab.h ytab.h
#	rm y.tab.c y.tab.h

ytab.h: ytab.c 

lexinit.o: lex.h lexinit.c express.h ytab.h

query.o: lex.h ytab.h query.c

evaltree.o: evaltree.c lex.h ytab.h express.h

eval_all.o: eval_all.c lex.h ytab.h express.h

eval_sec.o: eval_all.c lex.h ytab.h express.h

yexparse.o: yexparse.c lex.h ytab.h express.h

exprint.o: exprint.c lex.h ytab.h express.h

tmain.o: tmain.c include.h


