source: trunk/libs/newlib/src/symlink-tree @ 577

Last change on this file since 577 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.2 KB
Line 
1#!/bin/sh
2# Create a symlink tree.
3#
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
18# Foundation, Inc., 51 Franklin Street, Fifth Floor,
19# Boston, MA 02110-1301, USA.
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
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
38if test $# -lt 1; then
39  echo "symlink-tree error:  Usage: symlink-tree srcdir \"ignore1 ignore2 ...\""
40  exit 1
41fi
42
43ignore_additional=". .. CVS"
44
45# If we were invoked with a relative path name, adjust ${prog} to work
46# in subdirs.
47case ${prog} in
48/* | [A-Za-z]:[\\/]*) ;;
49*) prog=../${prog} ;;
50esac
51
52# Set newsrcdir to something subdirectories can use.
53case ${srcdir} in
54/* | [A-Za-z]:[\\/]*) newsrcdir=${srcdir} ;;
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
Note: See TracBrowser for help on using the repository browser.