]> git.ipfire.org Git - thirdparty/gcc.git/blame - symlink-tree
Centralize PICFLAG configuration
[thirdparty/gcc.git] / symlink-tree
CommitLineData
6599da04
JM
1#!/bin/sh
2# Create a symlink tree.
3#
74bed51b
ADL
4# Copyright (C) 1995, 2000, 2003 Free Software Foundation, Inc.
5#
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.
10#
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.
15#
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
0063a823
KC
18# Foundation, Inc., 51 Franklin Street, Fifth Floor,
19# Boston, MA 02110-1301, USA.
74bed51b
ADL
20#
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.
25#
26# Please report bugs to <gcc-bugs@gnu.org>
27# and send patches to <gcc-patches@gnu.org>.
28
6599da04
JM
29# Syntax: symlink-tree srcdir "ignore1 ignore2 ..."
30#
31# where srcdir is the directory to create a symlink tree to,
32# and "ignoreN" is a list of files/directories to ignore.
33
34prog=$0
35srcdir=$1
36ignore="$2"
37
3abaac67
PE
38if test $# -lt 1; then
39 echo "symlink-tree error: Usage: symlink-tree srcdir \"ignore1 ignore2 ...\""
40 exit 1
41fi
42
6599da04
JM
43ignore_additional=". .. CVS"
44
45# If we were invoked with a relative path name, adjust ${prog} to work
46# in subdirs.
47case ${prog} in
fc26516b 48/* | [A-Za-z]:[\\/]*) ;;
6599da04
JM
49*) prog=../${prog} ;;
50esac
51
52# Set newsrcdir to something subdirectories can use.
53case ${srcdir} in
fc26516b 54/* | [A-Za-z]:[\\/]*) newsrcdir=${srcdir} ;;
6599da04
JM
55*) newsrcdir=../${srcdir} ;;
56esac
57
58for 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
64 fi
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}")
70 fi
71 else
72 echo "$f ..linked"
73 rm -f $f
74 ln -s ${srcdir}/$f .
75 fi
76done
77
78exit 0