#			Copyright 1989,1990,1991,1992 by
#			Advanced Visual Systems Inc.
#			All Rights Reserved
#	
#	This software comprises unpublished confidential information of
#	Advanced Visual Systems Inc. and may not be used, copied or made
#	available to anyone, except in accordance with the license
#	under which it is furnished.
#	
#	This file is under sccs control at AVS in:
#	/sccs1.p/avs/examples/s.Makefile
#	
# AVS example modules Makefile for Generic-AVS
#	
# There are some definitions like INC_FILE, F77_INC, etc that do not
# ordinarily need to be separated out - but this Makefile may be used
# from a variety of build environments.

# If AVS is not installed in /usr/avs, then set the AVS_PATH environment
# variable and override it during the make as in:
#    setenv AVS_PATH /my_dir/avs
#    make -e

AVS_PATH=/usr/avs
INC_FILE=$(AVS_PATH)/include/Makeinclude
MLIB=-lm
include $(INC_FILE)

AVS_LIBS=$(AVS_PATH)/lib
BASELIBS=-lgeom -lutil -lm
FBASELIBS=-lgeom -lutil
FLOWLIBS=-L$(AVS_LIBS) -lflow_c $(BASELIBS) $(LASTLIBS)
CSIMLIBS=-L$(AVS_LIBS) -lsim_c $(BASELIBS) $(LASTLIBS)
MODLIBS=-L$(AVS_LIBS) -lmdata -lmfilt -lmmapp -lmrend -lrf
AVS_INC=-I. -I$(AVS_PATH)/include
CFLAGS=$(ACFLAGS) $(AVS_INC)

# In order to use C++, you will need to modify the CPP and CPPLIBS definitions
# to match your local system conventions. 
CPPFLOWLIBS=$(FLOWLIBS) -lc -lC -lc
CPPSIMLIBS=$(CSIMLIBS) -lc -lC -lc
CPPHOME=/usr
CPPLIBS=-L$(CPPHOME)/lib
CPP=$(CPPHOME)/bin/CC
CPPFLAGS=$(CFLAGS) $(CPPLIBS)

F77_FLOWLIBS=-L$(AVS_LIBS) -lflow_f   $(FBASELIBS) $(MLIB) $(LASTFLIBS)
F77_SIMLIBS=-L$(AVS_LIBS) -lsim_f  $(FBASELIBS) $(MLIB) $(LASTFLIBS) 
F77_BIND= $(AVS_PATH)/bin/f77_binding
F77_INC= $(AVS_PATH)/include
F77FLAGS=$(AFFLAGS)
FFLAGS=$(F77FLAGS)

C_EXAMPLES= Read_Radiance 

# If there is no FORTRAN compiler on your machine, do the following:
#   setenv F77_EXAMPLES
#   make -e
# Building the examples library will have complaints because of the missing
# modules but it should still make a usable library for the C modules.


# The C++ examples are currently just C examples that have been reworked
# to work for both C and C++ compilers.

.SUFFIXES: .o .cpp .C .c

.cpp.o: $*.cpp
	$(CPP) +d $(CFLAGS) -c $*.cpp

#**********************************************************************
EXAMPLES=$(C_EXAMPLES) 

all: $(EXAMPLES)

#
# Make sure to clean all out files that were created so that pkgrm can
# remove this directory
#

#**********************************************************************
# Example Modules and support files

Read_Radiance: Read_Radiance.o 
	$(CC) $(CFLAGS) -O3 -o Read_Radiance.MOD Read_Radiance.o $(FLOWLIBS) -lc -lm 



CFILES = `ls *.c`
lint:
	$(LINT) $(LINTFLAGS) $(AVS_INC) $(CFILES) > examples.lint