# $Id: Makefile,v 1.3 93/08/13 14:05:19 gbourhis Exp $

# Polyview 3.1 for Silicon Graphics 4D workstations.
# Software Development Group
# National Center for Supercomputing Applications
# University of Illinois at Urbana-Champaign
# Problems?  Email polyview@ncsa.uiuc.edu.

all: polyview

# Flags for source code compilation.
# -DIRIS4 is needed for HDF includes.
# -DDO_AUDIO is used if we want a noisy GUI.
# -DRENDERMAN if we want to output Renderman source files.
# RM_INCS if we want to deal with Renderman include files.
# Renderman include files.
RM_INCS =  -I/mondrian1/prman/include
ALLINCLUDES = -I../include $(RM_INCS) -I.. -I/usr/local/include/dtm
ALLDEFINES = $(ALLINCLUDES) -DIRIS4 -DDO_AUDIO -DRENDERMAN -D__STDC__
CFLAGS = -g $(ALLDEFINES)

# Flags for final link/load stage.
LDFLAGS = -L../lib -L../../hdf/src

# -ldf is HDF library & Vset library.
# -ldtm is DTM library.
# -lXirisw is IRIS windowing library.
# -lXm_s, -lXt_s, -lX11_s are X/Motif libraries.
# -lsphere is GL sphere library.
# -lgl_s is shared GL library.
# -lsun is Sun compatibility library (for YP/NIS support).
# -lmalloc is enhanced malloc support.
# -lPW is Programmer's Workbench library, for regexp().
# -lm is math library.
# -laudio is audio library for Indigo audio HW.
# RM_LIBS is renderman rib library. 
NCSA_LIBS =  -ldtmExt -ldf -ldtm
#RM_LIBS = /bert/prman/lib/librib.a
RM_LIBS = /mondrian1/prman/lib/librib.a
XWIN_LIBS = -lXirisw -lXm_s -lXt_s -lX11_s
GL_LIBS = -lsphere -lgl_s -limage
SYS_LIBS = -lsun -lmalloc -lPW -lm
AUDIO_LIBS = -laudio
LIBS = $(NCSA_LIBS) $(RM_LIBS) $(GL_LIBS) $(XWIN_LIBS) $(SYS_LIBS) $(AUDIO_LIBS)

# MAIN_C are primary Polyview source files; they will be
# processed by mkproto to generate pvproto.h.
MAIN_C = pvmain.c pvdraw.c pvdata.c pvpick.c pvvset.c \
  pvevent.c pvfuncs.c pvutil.c pvparse.c pvaction.c pvpoly.c \
  pvstatus.c pvpal.c pvtext.c pvmsg.c pvdtm.c \
  pvtime.c pvinfo.c pvraster.c pvlight.c pvhelp.c \
  pvray.c pvrender.c misc.c

# AUX_C are secondary Polyview source files with their
# own include files.
#RENDERMAN_C = placecam.c
AUX_C = net.c netdata.c list.c mesg.c \
  Xmx.c Xmx2.c \
  playaiff.c \
  quantizer.c \
  $(RENDERMAN_C)


quantizer.o: quantizer.c
	cc -O2 -c quantizer.c

# This constructs lists of object files.
MAIN_O = $(MAIN_C:.c=.o)
AUX_O = $(AUX_C:.c=.o)

# Make everything.
all: polyview

# Program executable.
polyview: $(MAIN_O) $(AUX_O)
	cc -o polyview $(LDFLAGS) $(MAIN_O) $(AUX_O) $(LIBS)

pvhelp.o: pvhelp.h

# This generates a single header file with prototypes for
# all non-static functions in the main source files.
mkproto: mkproto.c
	cc -o mkproto mkproto.c

proto: mkproto
	./mkproto $(MAIN_C) >pvproto.h

# This generates a TAGS file suitable for use with Emacs.
tags:
	etags -t *.c *.h

# This pulls in the latest net-module code from Dave T.
# BE CAREFUL with this, as Polyview usually requires a few
# tweaks before these can be used.
NETDIR = ~/glue/collage
updatenet:
#	cp $(NETDIR)/net.c $(NETDIR)/netdata.c .
	cp $(NETDIR)/net.h $(NETDIR)/netP.h $(NETDIR)/netdata.h ../include
	cp $(NETDIR)/list.h $(NETDIR)/listP.h $(NETDIR)/doodle.h ../include
	cp $(NETDIR)/collage.h ../include
#	cp $(NETDIR)/list.c $(NETDIR)/mesg.c .

clean:
	rm -f polyview *.o

backusr6:
	cp *.c *.h README Makefile /usr6/marca/pv3/new

backbert:
	cp *.c *.h README Makefile /bert/tmp/marca/new
