GEOM = ../../../../..
include ${GEOM}/makefiles/Makedefs.global
include ../Makedefs
include ${GEOM}/makefiles/Makerules.obj

MALLOCLIB = -lmalloc
#MALLOCLIB = -lmallocdebug

FORMSLIBS = -lforms -lfm_s

OOGLLIBS = -L${LIBDIR} -llisp -lmg -lcamera -lwindow \
	   -lgeom -lquad -lpolylist -lvect -lbezier -lmesh -lvect \
	   -linst -ltlist -llist -lbbox -lstub -lgeom \
	   -lshade -loogl -l3d -lcolor

L = ${GEOM}/lib/sgi
LIBDEPS = ${L}/libforms.a \
	${L}/liblisp.a ${L}/libmg.a ${L}/libcamera.a \
	${L}/libgeom.a ${L}/libquad.a ${L}/libpolylist.a ${L}/libvect.a \
	${L}/libbezier.a ${L}/libmesh.a ${L}/libvect.a ${L}/libstub.a \
	${L}/libshade.a ${L}/liboogl.a ${L}/lib3d.a ${L}/libcolor.a

_panelstuff:	../panel.c ../panel.h

# only check on the following if we're at the Geometry Center; 
#  --- assume that if /u/gcg exists, then we're there !!

panel.c: ../panel.c
panel.h: ../panel.h

# Need to cp rather than ln here to ensure that, after executing,
# panel.? is really newer than ../panel.?

panel.c panel.h:
	rm -f $@
	cp ../$@ .

glui.o: panel.c panel.h

#../panel.c ../panel.h:	../panel.fd
#	@if [ -d /u/gcg/ ] ; then \
#	  echo "" ; \
#	  echo " WARNING " ; \
#	  echo "" ; \
#	  echo "    panel.fd has been modified more recently than" ; \
#	  echo "    panel.c and/or panel.h.  You need to run fdesign2" ; \
#	  echo "    to regenerate panel.c and panel.h" ; \
#	  echo "" ; \
#	fi

install:	install_bin

install_bin:	geomview
	${INSTALL} -O -v -F ${GEOM}/bin/${MACHTYPE} geomview
	( cd ${GEOM}/bin/${MACHTYPE} ;	\
	  strip geomview ;		\
	  chmod 555 geomview ;		\
	  rm -f gv ;			\
	  ln geomview gv )

${GEOM}/lib/sgi/libforms.a:
	cd ${GEOM}/src/lib/forms ; ${MAKE} install

${COMMONOBJS} :
	rm -f $@ ${@:o=c}
	ln ../../common/${@:o=c} .
	${CC} -I../../common -DRMAN ${CFLAGS} -c ${@:o=c}

gv:	geomview

geomview:	${COMMONOBJS} ${OBJS} ${LIBDEPS}
	rm -f gv geomview ../gv ../geomview || :
	$(CC) -g -o $@ ${COMMONOBJS} \
	  ${OBJS} \
	  ${OOGLLIBS} \
	  ${FORMSLIBS} \
	  ${MALLOCLIB} -lgl_s -lm -lc_s
	ln geomview ..
	ln geomview gv
	ln gv ..

