#  25 May 2011. RCG
#	Change the name of the resulting dir to be _dir_ so it won't replace
# 	an existing version of dir. 
#   1 Sep 04.   WJS
#	 serv has its own make file.  Leave old stuff in, commented, for
#     a while (hopefully short)

HTMLBINDIR  = ../../htmlbin
LIBDIR = ../lib

#EXECS =  ${HTMLBINDIR}/serv 

SCRIPTS = ${HTMLBINDIR}/dir

#Line commented out July 20, 2010 rcg as per patch instructions
#	  ${HTMLBINDIR}/info

#all:	${EXECS} \
#	${SCRIPTS}
all:	${SCRIPTS}

#${HTMLBINDIR}/serv: serv.o ${LIBDIR}/jgofs.a
#	-mkdir ${HTMLBINDIR}
#	$(CC) ${CFLAGS} serv.o ${LIBDIR}/jgofs.a  -o $@
#serv.o:serv.c
#	$(CC) ${CFLAGS} -DOPTIONSERVER='"${OPTIONSERVER}"' -DJGOFSDIR='"${JGOFSDIR}"' -c serv.c

# Purpose:
#   builds dir, from PERL 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
#
#  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'.
#
#  INFOSERVER:  by default, machine and program used to serve
#               documentation files
#                      Example:     www.jgofs.org:80/jg/info
#
##############
#
# Where to place the custom '_dir_'
#

${HTMLBINDIR}/_dir_: dir_pl.tmp
	@- test -d ${HTMLBINDIR} || mkdir ${HTMLBINDIR}
	sed "s*perllocation*${PERL}*g;\
		     s*myaddr*${MYADDR}*g;\
		     s*dmoname*${DMONAME}*g;\
		     s*jgofsdir*${JGOFSDIR}*g;\
		     s*objectdir*${OBJDIR}*g;\
		     s*imagedirectory*${BUTTONIMAGESDIR}*g;\
		     s*informationserver*${INFOSERVER}*g" <dir_pl.tmp > $@;
	chmod +x $@;

# Purpose:
#   builds info, from PERL 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
#
#  INFOSERVER:  by default, machine and program used to serve
#               documentation files
#                      Example:   www.jgofs.org:80/jg/info
#
#  BUTTONIMAGESDIR:  directory where image files are located, relative to 
#                 MYADDR's DocumentRoot.  Intention is to find the GIF 
#                 files used for the 'Directory' and 'Data display' buttons.
#
##############
#

${HTMLBINDIR}/info: info_pl.tmp
	@- test -d ${HTMLBINDIR} || mkdir ${HTMLBINDIR}
	sed "s*perllocation*${PERL}*g;\
		     s*dmoname*${DMONAME}*g;\
                     s*imagedirectory*${BUTTONIMAGESDIR}*g;\
		     s*jgofsdir*${JGOFSDIR}*g;\
		     s*informationserver*${INFOSERVER}*g" < info_pl.tmp > $@; \
	chmod +x $@;

clean:
	-rm ${EXECS} ${SCRIPTS} *.o
