1998-03-01 22:58:51 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Create a symlink tree.
|
|
|
|
#
|
2004-06-16 05:45:41 +00:00
|
|
|
# Copyright (C) 1995, 2000, 2003 Free Software Foundation, Inc.
|
|
|
|
#
|
|
|
|
# This file is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
# Boston, MA 02111-1307, USA.
|
|
|
|
#
|
|
|
|
# As a special exception to the GNU General Public License, if you
|
|
|
|
# distribute this file as part of a program that contains a
|
|
|
|
# configuration script generated by Autoconf, you may include it under
|
|
|
|
# the same distribution terms that you use for the rest of that program.
|
|
|
|
#
|
|
|
|
# Please report bugs to <gcc-bugs@gnu.org>
|
|
|
|
# and send patches to <gcc-patches@gnu.org>.
|
|
|
|
|
1998-03-01 22:58:51 +00:00
|
|
|
# Syntax: symlink-tree srcdir "ignore1 ignore2 ..."
|
|
|
|
#
|
|
|
|
# where srcdir is the directory to create a symlink tree to,
|
|
|
|
# and "ignoreN" is a list of files/directories to ignore.
|
|
|
|
|
|
|
|
prog=$0
|
|
|
|
srcdir=$1
|
|
|
|
ignore="$2"
|
|
|
|
|
2001-05-28 05:21:37 +00:00
|
|
|
if test $# -lt 1; then
|
|
|
|
echo "symlink-tree error: Usage: symlink-tree srcdir \"ignore1 ignore2 ...\""
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
1998-03-01 22:58:51 +00:00
|
|
|
ignore_additional=". .. CVS"
|
|
|
|
|
|
|
|
# If we were invoked with a relative path name, adjust ${prog} to work
|
|
|
|
# in subdirs.
|
|
|
|
case ${prog} in
|
2002-01-27 12:00:11 +00:00
|
|
|
/* | [A-Za-z]:[\\/]*) ;;
|
1998-03-01 22:58:51 +00:00
|
|
|
*) prog=../${prog} ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Set newsrcdir to something subdirectories can use.
|
|
|
|
case ${srcdir} in
|
2002-01-27 12:00:11 +00:00
|
|
|
/* | [A-Za-z]:[\\/]*) newsrcdir=${srcdir} ;;
|
1998-03-01 22:58:51 +00:00
|
|
|
*) newsrcdir=../${srcdir} ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
for f in `ls -a ${srcdir}`; do
|
|
|
|
if [ -d ${srcdir}/$f ]; then
|
|
|
|
found=
|
|
|
|
for i in ${ignore} ${ignore_additional}; do
|
|
|
|
if [ "$f" = "$i" ]; then
|
|
|
|
found=yes
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -z "${found}" ]; then
|
1998-09-06 22:57:45 +00:00
|
|
|
echo "$f ..working in"
|
1998-03-01 22:58:51 +00:00
|
|
|
if [ -d $f ]; then true; else mkdir $f; fi
|
|
|
|
(cd $f; ${prog} ${newsrcdir}/$f "${ignore}")
|
|
|
|
fi
|
|
|
|
else
|
1998-09-06 22:57:45 +00:00
|
|
|
echo "$f ..linked"
|
1998-03-01 22:58:51 +00:00
|
|
|
rm -f $f
|
|
|
|
ln -s ${srcdir}/$f .
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|