# Top-level directory:
prefix = $(HOME)/shalstab/unix
exec_prefix =$(prefix)

# Source directory:
SRC_DIR = $(exec_prefix)/src

# Library directory:
LIB_DIR = $(exec_prefix)/lib

# Include directory:
INC_DIR = $(exec_prefix)/inc

# Shalstab libraries:
STAB_LIB = -lRRgrid -lg++ -lstdc++ -liostream -lc -lm

# Libraries to link: 
LIBS = -L$(LIB_DIR) -L/usr/lib $(STAB_LIB)

# Include files:
INCS = -I$(INC_DIR)

# Compiler switches:
CFLAGS = -O

# Other variables:
AC_FLAGS =		 -DHAVE_LIBM=1
RANLIB =		ranlib

# Compiler Variables:
CC = gcc
CC_SWITCHES = $(CFLAGS) $(INCS) $(AC_FLAGS) 

# Source files:
SRCS =	area.cc surf2arc.cc arc2surf.cc removesinks.cc \
	testsinks.cc slope.cc qovert.cc shalstab.cc \
	curvature.cc mkgrid.cc mktable.cc

# Object files:
OBJS =	area.o surf2arc.o arc2surf.o removesinks.o \
	testsinks.o slope.o qovert.o shalstab.o \
	curvature.o mkgrid.o mktable.o

# Executable files:
PROGS =	area surf2arc arc2surf removesinks \
	testsinks slope qovert shalstab \
	curvature mkgrid mktable

all: $(PROGS)

area: area.o
	$(CC) $(CC_SWITCHES) area.o $(LIBS) -o area

testsinks: testsinks.o 
	$(CC) $(CC_SWITCHES) testsinks.o $(LIBS) -o testsinks

arc2surf: arc2surf.o 
	$(CC) $(CC_SWITCHES) arc2surf.o $(LIBS) -o arc2surf

surf2arc: surf2arc.o 
	$(CC) $(CC_SWITCHES) surf2arc.o $(LIBS) -o surf2arc

removesinks: removesinks.o
	$(CC) $(CC_SWITCHES) removesinks.o $(LIBS) -o removesinks

slope: slope.o 
	$(CC) $(CC_SWITCHES) slope.o $(LIBS) -o slope

curvature: curvature.o 
	$(CC) $(CC_SWITCHES) curvature.o $(LIBS) -o curvature

qovert: qovert.o 
	$(CC) $(CC_SWITCHES) qovert.o $(LIBS) -o qovert

shalstab: shalstab.o 
	$(CC) $(CC_SWITCHES) shalstab.o $(LIBS) -o shalstab

mkgrid: mkgrid.o 
	$(CC) $(CC_SWITCHES) mkgrid.o $(LIBS) -o mkgrid

mktable: mktable.o 
	$(CC) $(CC_SWITCHES) mktable.o $(LIBS) -o mktable

.cc.o:
	$(CC) -c $(CC_SWITCHES) $<
