#! /bin/sh
#*******************************************************************************
# E.S.O. - VLT project
#
# "@(#) $Id: vltMakeScriptDependencies,v 1.2 2012/01/13 18:54:47 tstaig Exp $" 
#
# who       when      what
# --------  --------  ----------------------------------------------
# gfilippi  24/10/94  created
# gfilippi  25/10/94  stop on error ("-" removed from the make command)
# gfilippi  08/12/94  handle one script at time
# gfilippi  20/12/95  use +wx (cmmCopy gives r--r--r-- files)
# rschmutz 1999-04-03 use vltMakeScript to copy the script to ../bin.

#************************************************************************
#   NAME
#   vltMakeScriptDependencies - create the makefile to build one scripts
# 
#   SYNOPSIS
#
#   vltMakeScriptDependencies <scriptName>
# 
#   DESCRIPTION
#   Utility used by vltMakefile to create the makefile to build one scripts.
#   It is not intended to be used as a standalone command.
#
#   Each ../bin-executable script depends on the source file:
#
#   ../bin/<scriptName>: <scriptName> Makefile
#   <TAB>   -$(AT) echo "== Making script: $(scriptName)"
#   <TAB>   -$(AT) vltMakeScript $(scriptName)
#
#   The rule is written to standard output.
#
#   <scriptName>  The script to be treated
#
#
#   FILES
#   $VLTROOT/include/vltMakefile.all  
#
#   ENVIRONMENT
#
#   RETURN VALUES
#
#   SEE ALSO 
#   vltMakefile.all, Makefile, (GNU) make
#
#   GNU make - Edition 0.41, for make Version 3.64 Beta, April 93
#   VLT Software - Programming Standard - 1.0 10/03/93
#
#   BUGS    
#
#----------------------------------------------------------------------

echo "SCRIPT_NAME = $1"
if [ "${1}" != "" ]
then
    scriptName=$1
else
    echo "ERROR: vltMakeScriptDependencies called with no parameters" >&2
    exit 1
fi

echo "# Dependency file for script: ${scriptName}"
echo "# Created automatically by vltMakeScriptDependencies -  `date '+%d.%m.%y %T'`"
echo "# DO NOT EDIT THIS FILE"

#
# define the dependency file dependent to the Makefile
echo "../object/${scriptName}.ds: Makefile"
echo ""

#
# write on output the rule to build the script.
if [ -f ${scriptName}.py ]
then
    echo "../bin/${scriptName}: ${scriptName}.py Makefile"
else
    echo "../bin/${scriptName}: ${scriptName} Makefile"
fi
echo "	@echo \"== Making script: ../bin/${scriptName}\" "
echo "	\$(AT)vltMakeScript ${scriptName} "
#
# ___oOo___
