#
# Makefile
#
# Makefile to build the programs in utah-g3d
#
# This file is part of utah-g3d.
#
# utah-g3d is copyright (c) 2000,2001 by
# Paul Gettings,
# Department of Geology & Geophysics,
# University of Utah.
#
# All Rights Reserved.
# 
# utah-g3d is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License, version 2, as
# published by the Free Software Foundation.
# 
# utah-g3d is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details, in the file
# COPYING.  If that file is not present, write to the Free
# Software Foundation, 59 Temple Place - Suite 330, Boston, MA  
# 02111-1307, USA

# Simple Makefile

# Set to your local C++ compiler
#  All but openglvis, newton, and simanneal can be compiled with a
#  standard C compiler, if necessary
CC = g++

# For AMD Athlon CPUs
CC_OPTS = -O3 -march=pentiumpro -mcpu=k6
# For Pentium II/III CPUs
#CC_OPTS = -O3 -march=pentiumpro
# Uncomment this line for profiling information
#CC_OPTS = -pg
# Uncomment this line for debugging information
#CC_OPTS = -g

MODEL_OBJS = model.o
TREE_OBJS = blocktree.o
DEM_OBJS = dem.o
RAND_OBJS = gaussrand.o mt.o

all: compute vis openglvis genModel simanneal newton

compute: compute.c $(MODEL_OBJS)
	$(CC) $(CC_OPTS) -o $@ $^ -lm

vis: vis.c $(MODEL_OBJS)
	$(CC) $(CC_OPTS) -o $@ $^ -lm

openglvis: openglvis.cpp $(MODEL_OBJS)
	$(CC) $(CC_OPTS) -o $@ $^ -lglut -lGL -lm

genModel: genModel.o $(TREE_OBJS) $(MODEL_OBJS)
	$(CC) $(CC_OPTS) -o $@ $^ -lm

simanneal: simanneal.cpp $(MODEL_OBJS) $(RAND_OBJS)
	$(CC) $(CC_OPTS) -o $@ $^ -lm

newton: newton.cpp matrix.o $(MODEL_OBJS)
	$(CC) $(CC_OPTS) -o $@ $^ -lm

clean:
	rm -f compute vis genModel openglvis simanneal newton *.o \
		gmon.out test/speed_geom

model.o: model.c model.h
	$(CC) $(CC_OPTS) -c -o $@ model.c
blocktree.o: blocktree.c blocktree.h
	$(CC) $(CC_OPTS) -c -o $@ blocktree.c
genModel.o: genModel.c genModel.h
	$(CC) $(CC_OPTS) -c -o $@ genModel.c
gaussrand.o: gaussrand.c gaussrand.h
	$(CC) $(CC_OPTS) -c -o $@ gaussrand.c
mt.o: mt.c mt.h
	$(CC) $(CC_OPTS) -c -o $@ mt.c
matrix.o: matrix.c matrix.h
	$(CC) $(CC_OPTS) -c -o $@ matrix.c
