# Makefile file for WebOOGL source installation
# <http://www.geom.umn.edu/locate/weboogl/>

########################################################################
# Variables to change if necessary
########################################################################

# Place to install the programs. The directory needs to be in the
# user's path. If you want to just keep the programs in this
# directory, you must provide a full pathname: 
# don't use "." to mean the current directory.

INSTALLDIR=/usr/local/bin

# The perl binary on your system. 
# It's "/usr/sbin/perl" by default on Irix 5.x systems.
PERLPATH=/usr/local/bin/perl

# Change this if you've installed libwww-perl elsewhere.
LIBWWWPATH=/usr/local/lib/libwww-perl-0.40

# Change if necessary for your local system; this is the directory
# for files like sys/socket.ph. 
LOCALLIB=/usr/local/lib/perl

# Set this directory to the "Geomview root" directory on your system;
# that is, the top level directory of the main Geomview distribution.
# While the WebOOGL system can run with just the "gvx" executable
# provided, the full Geomview distribution gives you documentation,
# data files, and many "external modules" that add value to Geomview. 
#

# Note that if you install the main Geomview distribution *after* this
# one, you need to re-install this WebOOGL distribution so that you
# use the newest "gvx" executable (i.e. type "make scripts" again).
# The version needed for the WebOOGL package is more recent than the
# officially released one.

GVDIR=/usr/local/src/Geomview

########################################################################
# Code that shouldn't need to change
########################################################################

PERLSCRIPTS = weboogl.perl to-weboogl.perl gvgeturl.perl 
SCRIPTS = $(PERLSCRIPTS) geomview gvx
PROGS = vrml2oogl woogl2oogl 
CP = /bin/cp

all:	scripts progs

scripts:
	$(PERLPATH) -pi.orig -e 's#(.*)GEOMVIEW_GVX=(.*)#: \$${GEOMVIEW_GVX=$(INSTALLDIR)/gvx}#o' geomview
	$(PERLPATH) -pi.orig -e 's#^geomview_dir=(.*)#geomview_dir=\"$(GVDIR)\"#o' geomview
	$(PERLPATH) -pi.orig -e 's#/usr/local/bin/perl#$(PERLPATH)#o' $(PERLSCRIPTS)
	$(PERLPATH) -pi.orig -e 's#/usr/local/lib/libwww-perl-0.40#$(LIBWWWPATH)#o' gvgeturl.perl
	$(PERLPATH) -pi.orig -e 's#/usr/local/lib/perl#$(LOCALLIB)#o' gvgeturl.perl
	chmod 755 $(SCRIPTS)
	$(CP) $(SCRIPTS) $(INSTALLDIR)


progs:
	chmod 755 $(PROGS)
	$(CP) $(PROGS) $(INSTALLDIR)
