# Name:  makefile.download
#
# Created:  24 June 1999 by cchandler
# Usage:  make -f makefile.download
#	  to update download script files for current environment
#
# Assumes jgofs 1.5 distribution and that this file,
#    along with the sources, is in optsrc/download under the jgofs root.
#
# Can be run standalone if:
#       1) jgofs_root/opt-build-env has been executed first in context of
#          this process (ie, cd jgofs_root; source opt-build-env)
#	2) jgofs 1.5 distribution already installed
#
#
# Modification history:
# 991129.clc. mods to merge download with rest of jgofs ooptserver.
# 991201.clc. OPTSERVADDR
# 991203.clc. DIRSERVADDR and jgdirserver
#
#
# *******************************************************************
#   Remember to cd jgofs_root; source opt-build-env first, if you are 
#   building download utility outside the toplevel build procedure 
# *******************************************************************
#
TOPLEVELDIR  = 	../..
OPTSERVERBIN = 	optbin
SCRIPTDIR    = 	${TOPLEVELDIR}/${OPTSERVERBIN}
OPTSERVADDR  = 	http://${OPTIONSERVER}
DIRSERVADDR  = 	http://${DIRSERVER}

TODO =  ${SCRIPTDIR}/download-1 \
        ${SCRIPTDIR}/download-2 \
        ${SCRIPTDIR}/download-3 \
        ${SCRIPTDIR}/download-4 \
        ${SCRIPTDIR}/download-problem 

all: ${TODO} dnldhelp
	@echo " "; echo "Download utility has been updated."; echo " "

${SCRIPTDIR}/download-1: download-1.tmp
	sed "s*perllocation*${PERL}*g;\
	s*jgscriptloc*${JGSCRIPTDIR}*g;\
	s*webimgsdir*${BUTTONIMAGESDIR}*g;\
	s*jghelpaddr*${HELPADDR}*g;\
	s*jgdirserver*${DIRSERVADDR}*g;\
	s*jgooptserver*${OPTSERVADDR}*g;" < download-1.tmp >$@
	chmod +x $@;

${SCRIPTDIR}/download-2: download-2.tmp
	sed "s*perllocation*${PERL}*g;\
   	s*jgopthomedir*${JGOFSDIR}*g;\
	s*jgscriptloc*${JGSCRIPTDIR}*g;\
	s*webimgsdir*${BUTTONIMAGESDIR}*g;\
	s*jghelpaddr*${HELPADDR}*g;\
	s*jgdirserver*${DIRSERVADDR}*g;\
	s*jgooptserver*${OPTSERVADDR}*g;" < download-2.tmp >$@
	chmod +x $@;

${SCRIPTDIR}/download-3: download-3.tmp
	sed "s*perllocation*${PERL}*g;\
   	s*jgscriptloc*${JGSCRIPTDIR}*g;\
	s*webimgsdir*${BUTTONIMAGESDIR}*g;\
	s*jghelpaddr*${HELPADDR}*g;" < download-3.tmp >$@
	chmod +x $@;

${SCRIPTDIR}/download-4: download-4.tmp
	sed "s*perllocation*${PERL}*g;\
   	s*jgopthomedir*${JGOFSDIR}*g;\
   	s*jgscriptloc*${JGSCRIPTDIR}*g;\
	s*webimgsdir*${BUTTONIMAGESDIR}*g;\
	s*jginfoserver*${INFOSERVER}*g;\
	s*jgooptserver*${OPTSERVADDR}*g;\
	s*whichzip*${ZIPPROG}*g;\
        s*whichtar*${TARPROG}*g;\
        s*whichcompress*${UNIXCOMPRESS}*g;\
        s*whichgzip*${GNUCOMPRESS}*g" < download-4.tmp >$@
	chmod +x $@;

${SCRIPTDIR}/download-problem: download-problem.tmp
	sed "s*perllocation*${PERL}*g" < download-problem.tmp >$@
	chmod +x $@;

dnldhelp:	
	-cp download-help.html ${TOPLEVELDIR}/${HELPDIR}/download-help.html
		
####################	
clean:
	-rm ${TODO}
