# Makefile for 'distribute' and 'points_wish'
#
# $Id: Makefile,v 1.1 96/02/11 21:36:28 leech Exp $
#
# Copyright (C) 1996, Jonathan P. Leech
#
# This software may be freely copied, modified, and redistributed,
# provided that this copyright notice is preserved on all copies.
#
# There is no warranty or other guarantee of fitness for this software,
# it is provided solely "as is". Bug reports or fixes may be sent
# to the author, who may or may not act on them as he desires.
#
# You may not include this software in a program or other software product
# without supplying the source, or without informing the end-user that the
# source is available for no extra charge.
#
# If you modify this software, you should include a notice giving the
# name of the person performing the modification, the date of modification,
# and the reason for such modification.
#
# $Log:	Makefile,v $
# Revision 1.1  96/02/11  21:36:28  leech
# Initial revision
# 
#

# The C++ compiler to use; change to 'g++' for GNU CC
CC = CC

# Where to look for Tcl/Tk/X libraries & headers
MOD = /usr/local/contrib/mod
TKINC = -I$(MOD)/include/tcl7.4
TKLIB = -L$(MOD)/lib/tcl7.4 $(MOD)/lib/tcl7.4/libitcl.a -ltk -ltcl
XINC = -I/usr/local/include/X11R5
XLIB = -L/usr/local/lib/X11R5 -lXext -lX11

# You may need to add OS or compiler specific flags to CFLAGS.
CFLAGS = $(DB) -I. $(TKINC) $(XINC)
FFLAGS = $(DB)

# Most AT&T C++ compilers keep their include files in /usr/include/CC.
# If different, change CCINCLDIR to the directory where your compiler
#   keeps header files. This isn't important unless you want to
#   'make depend'.
CCINCLDIR   = /usr/include/CC
DEPENDFLAGS  = -D__cplusplus -I$(CCINCLDIR)

all: distribute points_wish

# Common objects for both text & GUI interfaces
APPOBJS = SphereState.o algebra.o dvector.o nnsort.o vrml.o

# Build simulation program with command-line interface
OBJS = driver.o Interface.o text.o $(APPOBJS)
distribute: $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) -o $@ -lm

# Build simulation program with Tk interface
TKOBJS = points.o cmd.o $(APPOBJS)
points_wish: $(TKOBJS)
	$(CC) $(CFLAGS) $(TKOBJS) $(TKLIB) $(XLIB) -o $@ -lm

nndriver: nndriver.o nnsort.o
	$(CC) nndriver.o nnsort.o -o nndriver

# Build distribution tape
tar:
	tar cf distribute.tar \
	    README MANIFEST Makefile \
	    distribute.l distribute.cat distribute.ps \
	    Interface.[ch] SphereState.[ch] algebra.[ch] boolean.h cmd.c \
	    cvector.h driver.c dvector.[ch] nnsort.[ch] points.c text.c \
	    vector_names.h vrml.[ch] \
	    points points.tcl ui.tcl util.tcl vec.tcl Varedit.tcl \
	    samples

distribute.cat: distribute.l
	nroff -man distribute.l > $@

distribute.ps: distribute.l
	groff -man distribute.l > $@

clean:
	-rm -f *.o distribute points_wish distribute.cat distribute.ps

# These dependencies should be adequate if 'makedepend' isn't available.

VEC_H = dvector.h cvector.h vector_names.h
ALG_H = algebra.h $(VEC_H)
SPH_H = SphereState.h boolean.h $(ALG_H)

Interface.o text.o:  $(SPH_H) Interface.h
SphereState.o cmd.o: $(SPH_H)
algebra.o:	     $(ALG_H)
driver.o points.o:   $(VEC_H) Interface.h boolean.h
points_tcl.o:	     $(VEC_H) Interface.h boolean.h
dvector.o:	     $(VEC_H)
cmd.o nnsort.o:      nnsort.h

depend:
	makedepend -- $(CFLAGS) $(DEPENDFLAGS) -- [A-Za-z]*.c

# DO NOT DELETE THIS LINE -- make depend depends on it.
