#
# Makefile for VolPack example programs.  If it has the name "Makefile.in"
# then it is a template for a Makefile; to generate the actual Makefile,
# run "./configure", which is a configuration script generated by the
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile).
#
# Copyright (c) 1994 The Board of Trustees of The Leland Stanford
# Junior University.  All rights reserved.
# 
# Permission to use, copy, modify and distribute this software and its
# documentation for any purpose is hereby granted without fee, provided
# that the above copyright notice and this permission notice appear in
# all copies of this software and that you do not sell the software.
# Commercial licensing is available by contacting the author.
# 
# THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
# 
# Author:
#    Phil Lacroute
#    Computer Systems Laboratory
#    Electrical Engineering Dept.
#    Stanford University
#

# shell to use for executing make commands
SHELL =		/bin/sh

###########################################################################
# Options that can be changed by the user.
###########################################################################

# ANSI-C prototypes: use the first line to let the #ifdef's in
# volpack.h guess if your compiler supports prototypes, use the
# second line to disable prototypes, or use the third line to
# enable prototypes
PROTO_FLAG =
#PROTO_FLAG =	-DNO_PROTOTYPE
#PROTO_FLAG =	-DANSI_C

# optional compiler flags: use the first line for full optimization
# (configure will try to choose flags for your system), or use the
# second for no optimization; the other lines are for various levels
# of debugging
CCOPT_FLAGS = $(OFLAGS)
#CCOPT_FLAGS =
#CCOPT_FLAGS = -DASSERTIONS -fullwarn -g

# directory containing volpack
VOLPACK = ..

# include files for volpack
VPINCL = -I$(VOLPACK)

# library for volpack
VPLIB = $(VOLPACK)/libvolpack.a

###########################################################################
# Options that are changed by the configure script.  These should
# probably not be editted by hand.
###########################################################################

# pathname for the C compiler
CC = 		@CC@

# compiler options
AC_FLAGS = 	@DEFS@

# system-dependent options based on system name passed to configure;
# this macro is for options that should always be included (even for
# compiles with optimization turned off); configure can fill
# this in automatically if you supply a recognized system name
MFLAGS =	@MFLAGS@

# system-dependent options based on system name passed to configure;
# this macro is for optimization options only; configure can fill
# this in automatically if you supply a recognized system name
OFLAGS =	@OFLAGS@

###########################################################################
# Nothing beyond this point should need to be changed by the user.
###########################################################################

CFLAGS = -I. ${VPINCL} ${AC_FLAGS} ${CCOPT_FLAGS} ${MFLAGS} ${PROTO_FLAG}
LIBS = ${VPLIB} -lm

all: makevolume makeoctree classifyvolume rendervolume scalevolume

makevolume: makevolume.c volume.h $(VPLIB)
	$(CC) -o makevolume $(CFLAGS) makevolume.c $(LIBS)

makeoctree: makeoctree.c volume.h $(VPLIB)
	$(CC) -o makeoctree $(CFLAGS) makeoctree.c $(LIBS)

classifyvolume: classifyvolume.c volume.h $(VPLIB)
	$(CC) -o classifyvolume $(CFLAGS) classifyvolume.c $(LIBS)

rendervolume: rendervolume.c volume.h $(VPLIB)
	$(CC) -o rendervolume $(CFLAGS) rendervolume.c $(LIBS)

scalevolume: scalevolume.c denfile.c $(VPLIB)
	$(CC) -o scalevolume $(CFLAGS) scalevolume.c denfile.c $(LIBS)

checkin:
	ci -l -f classifyvolume.c makeoctree.c makevolume.c \
		 rendervolume.c scalevolume.c denfile.c volume.h \
		 Makefile.in test.csh test.out README

clean:
	rm -f makevolume makeoctree classifyvolume rendervolume scalevolume
	rm -f scalevolume.o denfile.o
	rm -f brainsmall.rv brainsmall.oct brainsmall.cv brainsmall.ppm
	rm -f brainsmall1.ppm brainsmall2.ppm
	rm -f brainsmall3.ppm brainsmall4.ppm
