# makefile.dir
# jgofs software v1.5
# Modified to copy new dir to DIR for testing only 4/15/97 rcg
# Purpose:
#   builds dir, from PERL version, if PERL environment variable exists
#   else builds the csh version.  
#
# NOTE:  env $PERL contains location of perl interpreter on this machine.
#
##############
# Values used to replace variables in template (*.tmp) file are:
#
#  (PERL version only) PERL:  which, if any, perl to use
#                      Example:       /usr/local/bin/perl
#
#  (if any) DMONAME:  name of program for which this is DMO
#                      Example:     US BIO-PROJ
#
#  MYADDR:     this machine's alias on the WWW
#                      Example:     //www.jgofs.org:80
#
#  JGOFSDIR:   top of the jgofs software tree; parent of OBJECTROOT
#                      Example:     /users/jgofs
#
#  OBJDIR:  below OBJECTROOT, where to begin looking for object defn's
#                      Example:      /jgofs
#
#  INFOSERVER:  by default, machine used to serve documentation files
#                      Example:     //www.jgofs.org:80
#
#  BUTTONIMAGESDIR:  directory where image files are located, relative to 
#                 MYADDR's DocumentRoot.  Intention is to find the GIF 
#                 used to indicate the current directory, 'youhere.gif'.
#
#  The length of the string formed by appending "objects" to value of JGOFSDIR
#                      Example:     /users/jgofs/objects == 20
##############
#
SHELL=/usr/bin/sh
# Where to place the custom 'dir'
HTMLBINDIR  = ../htmlbin/
#
LEN=`(echo "${JGOFSDIR}/objects" | nawk '{print length}')`

dir: dir_pl.tmp dir_csh.tmp
	if [ "$(PERL)" ]; \
	then \
		sed "s*perllocation*${PERL}*g" < $@_pl.tmp | \
		sed "s*dmoname*${DMONAME}*g" | \
		sed "s*myaddr*${MYADDR}*g" | \
		sed "s*jgofsdir*${JGOFSDIR}*g" | \
		sed "s*objectdir*${OBJDIR}*g" | \
		sed "s*imagedirectory*${BUTTONIMAGESDIR}*g" | \
		sed "s*informationserver*${INFOSERVER}*"g > $@; \
	else \
		sed "s*objectdir*${OBJDIR}*g" < $@_csh.tmp | \
		sed "s*dmoname*${DMONAME}*g" | \
		sed "s*myaddr*${MYADDR}*g" | \
		sed "s*jgofsdir*${JGOFSDIR}*g" | \
		sed "s*dirlength*${LEN}*g" | \
		sed "s*informationserver*${INFOSERVER}*"g > $@; \
	fi
	chmod +x $@;
###	cp $@ ${HTMLBINDIR}dir;
	cp $@ ${HTMLBINDIR}DIR;

