#!/bin/csh -f
#
# _linkConfigs <configFileToLinkTo> <dirToGoInto>
#
# Recursively traverse the <dirToGoInto> hierarchy, and each time we find
# a makefile, do a symbolic link of thefirst args Config file to Config.
# and as we recurse, keep adjusting the linktofile, so that it still points
# all the way back up to the original.
#
# This is used so that you can have one config file in a source hierarchy,
# and based on info in the current directory (IE NO ENV VARS), find
# the config flags.
#
#
set noglob

if ("$#argv" != 2) then
	echo usage: "_linkConfigs <configFileToLinkTo> <dirToGoInto>"
	exit 1
endif

cd $2
if (-e Makefile) then
	ln -s $1 Config;
endif

#hack workaroung for HP sh bug
set xxx = `ls`;
foreach sd ($xxx)
	if (-d "$sd") then
		if ("$sd" != "RCS") then
			_linkConfigs  "../$1" "$sd"
		endif
	endif
end
unset noglob


