# Makefile for Mathematica -> OOGL/geomview package
SHELL = /bin/sh

# You can "make" the following targets:
# 
#   all:	compiles togeomview.c.
#   install:	installs OOGL.m and OOGL.doc in the locations specified
#		  below
#   clean:	removes unnecessary files
#   veryclean:	removes unnecessary and recreatable files
#   mathoogl.tar.Z:  creates mathoogl.tar.Z --- the distribution file

# Set PACKAGEDIR to the pathname of the directory where you want OOGL.m
# and Geomview.m to be installed; this is used by 'make install'.
PACKAGEDIR = /u/geom/mathematica/Packages

# Set BINDIR to the pathname of the directory to install the "togeomview"
# binary.  It should either be on users' normal search paths or 
# be one of Mathematica's binary directories, e.g. .../Bin.Iris/Display.
BINDIR = /u/geom/bin

# Set DOCDIR to the pathname of the directory where you want OOGL.doc
# to be installed; this is used by 'make install'.
DOCDIR = /u/geom/mathematica/Doc

########################################################################

DISTFILES = COPYING README Makefile OOGL.doc OOGL.m Geomview.m togeomview.c 

all:	togeomview

CFLAGS = -O -s
togeomview: $$@.c
	${CC} -o $@ $@.c ${CFLAGS} -lc_s

clean:
	/bin/rm -f *~

veryclean:	clean
	/bin/rm -f mathoogl.tar.Z togeomview

install: all
	/bin/rm -f ${PACKAGEDIR}/OOGL.m ${PACKAGEDIR}/Geomview.m
	/bin/cp OOGL.m Geomview.m ${PACKAGEDIR}
	chmod 444 ${PACKAGEDIR}/OOGL.m ${PACKAGEDIR}/Geomview.m
	@echo ''
	@echo 'OOGL.m and Geomview.m installed in ${PACKAGEDIR}'
	@echo ''
	/bin/rm -f ${DOCDIR}/OOGL.doc
	/bin/cp OOGL.doc ${DOCDIR}
	chmod 444 ${DOCDIR}/OOGL.doc
	@echo ''
	@echo 'OOGL.doc installed in ${DOCDIR}'
	@echo ''
	/bin/rm -f ${BINDIR}/togeomview
	cp togeomview ${BINDIR}/togeomview
	chmod 555 ${BINDIR}/togeomview
	@echo ""; echo "togeomview installed in ${BINDIR}"; echo ""

mathoogl.tar.Z:	veryclean
	tar cvf - ${DISTFILES} | compress > /tmp/mathoogl.tar.Z
	/bin/mv /tmp/mathoogl.tar.Z .
