gas:
[binutils.git] / symlink-tree
bloba9d50831b885b7e17f890fef27f67332224f445c
1 #!/bin/sh
2 # Create a symlink tree.
4 # Copyright (C) 1995, 2000, 2003 Free Software Foundation, Inc.
6 # This file is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 # Boston, MA 02110-1301, USA.
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
26 # Please report bugs to <gcc-bugs@gnu.org>
27 # and send patches to <gcc-patches@gnu.org>.
29 # Syntax: symlink-tree srcdir "ignore1 ignore2 ..."
31 # where srcdir is the directory to create a symlink tree to,
32 # and "ignoreN" is a list of files/directories to ignore.
34 prog=$0
35 srcdir=$1
36 ignore="$2"
38 if test $# -lt 1; then
39 echo "symlink-tree error: Usage: symlink-tree srcdir \"ignore1 ignore2 ...\""
40 exit 1
43 ignore_additional=". .. CVS"
45 # If we were invoked with a relative path name, adjust ${prog} to work
46 # in subdirs.
47 case ${prog} in
48 /* | [A-Za-z]:[\\/]*) ;;
49 *) prog=../${prog} ;;
50 esac
52 # Set newsrcdir to something subdirectories can use.
53 case ${srcdir} in
54 /* | [A-Za-z]:[\\/]*) newsrcdir=${srcdir} ;;
55 *) newsrcdir=../${srcdir} ;;
56 esac
58 for f in `ls -a ${srcdir}`; do
59 if [ -d ${srcdir}/$f ]; then
60 found=
61 for i in ${ignore} ${ignore_additional}; do
62 if [ "$f" = "$i" ]; then
63 found=yes
65 done
66 if [ -z "${found}" ]; then
67 echo "$f ..working in"
68 if [ -d $f ]; then true; else mkdir $f; fi
69 (cd $f; ${prog} ${newsrcdir}/$f "${ignore}")
71 else
72 echo "$f ..linked"
73 rm -f $f
74 ln -s ${srcdir}/$f .
76 done
78 exit 0