#	PolyView 1.xx for the Personal IRIS
#	National Center for Supercomputing Applications
#	University of Illinois at Urbana-Champaign
#
#	Makes the PolyView 1.xx program.  Assumes that args.h, df.h, dfi.h,
#	libvg.a, libdf.a, and vg.h are in the local directory, along with
#	args.c and polyview.c.
#
#	Also makes the md program which creates a demo file for 
#	PolyView.  In turn, md is used to generate demo.hdf.
#
#	PolyView now uses shared libraries.

#  Make everything.
all: polyview md demo.hdf ;

#  Program executable.
polyview: args.o libvg.a libdf.a df.h dfi.h vg.h pvmain.o pvdraw.o pvdata.o \
          pvevent.o pvfuncs.o pvutil.o
	cc -o polyview pvmain.o pvdata.o pvdraw.o pvevent.o pvfuncs.o\
		pvutil.o args.o libvg.a libdf.a -lgl_s -lm

# Main code
pvmain.o: pvmain.c pv.h
	cc -co -g pvmain.o pvmain.c

# Data structures and HDF readers
pvdata.o: pvdata.c pv.h
	cc -co -g pvdata.o pvdata.c

# Drawing code
pvdraw.o: pvdraw.c pv.h
	cc -co -g pvdraw.o pvdraw.c

# Event handlers.
pvevent.o: pvevent.c pv.h
	cc -co -g pvevent.o pvevent.c

# Menus, parser, and functions
pvfuncs.o: pvfuncs.c pv.h
	cc -co -g pvfuncs.o pvfuncs.c

# General purpose utility functions
pvutil.o: pvutil.c pv.h
	cc -co -g pvutil.o pvutil.c

#  Command-line argument utilities.
args.o: args.c args.h
	cc -co -g args.o args.c

#  Demo file generator.
md: md.c libdf.a libvg.a vg.h
	cc -o md -g md.c libdf.a libvg.a

#  Make the demo file.
demo.hdf: md
	@echo
	@echo Generating demo.hdf file:
	md

#  If any of the libraries or include files are missing, then inform the user.
args.c args.h df.h dfi.h libdf.a libvg.a md.c vg.h:
	@echo $@ is required, but missing from this directory.
	@echo
