133965Sjdp#!/bin/sh 233965Sjdp# Create a symlink tree. 333965Sjdp# 4130561Sobrien# Copyright (C) 1995, 2000, 2003 Free Software Foundation, Inc. 5130561Sobrien# 6130561Sobrien# This file is free software; you can redistribute it and/or modify 7130561Sobrien# it under the terms of the GNU General Public License as published by 8130561Sobrien# the Free Software Foundation; either version 2 of the License, or 9130561Sobrien# (at your option) any later version. 10130561Sobrien# 11130561Sobrien# This program is distributed in the hope that it will be useful, 12130561Sobrien# but WITHOUT ANY WARRANTY; without even the implied warranty of 13130561Sobrien# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14130561Sobrien# GNU General Public License for more details. 15130561Sobrien# 16130561Sobrien# You should have received a copy of the GNU General Public License 17130561Sobrien# along with this program; if not, write to the Free Software 18218822Sdim# Foundation, Inc., 51 Franklin Street, Fifth Floor, 19218822Sdim# Boston, MA 02110-1301, USA. 20130561Sobrien# 21130561Sobrien# As a special exception to the GNU General Public License, if you 22130561Sobrien# distribute this file as part of a program that contains a 23130561Sobrien# configuration script generated by Autoconf, you may include it under 24130561Sobrien# the same distribution terms that you use for the rest of that program. 25130561Sobrien# 26130561Sobrien# Please report bugs to <gcc-bugs@gnu.org> 27130561Sobrien# and send patches to <gcc-patches@gnu.org>. 28130561Sobrien 2933965Sjdp# Syntax: symlink-tree srcdir "ignore1 ignore2 ..." 3033965Sjdp# 3133965Sjdp# where srcdir is the directory to create a symlink tree to, 3233965Sjdp# and "ignoreN" is a list of files/directories to ignore. 3333965Sjdp 3433965Sjdpprog=$0 3533965Sjdpsrcdir=$1 3633965Sjdpignore="$2" 3733965Sjdp 3877298Sobrienif test $# -lt 1; then 3977298Sobrien echo "symlink-tree error: Usage: symlink-tree srcdir \"ignore1 ignore2 ...\"" 4077298Sobrien exit 1 4177298Sobrienfi 4277298Sobrien 4333965Sjdpignore_additional=". .. CVS" 4433965Sjdp 4533965Sjdp# If we were invoked with a relative path name, adjust ${prog} to work 4633965Sjdp# in subdirs. 4733965Sjdpcase ${prog} in 4889857Sobrien/* | [A-Za-z]:[\\/]*) ;; 4933965Sjdp*) prog=../${prog} ;; 5033965Sjdpesac 5133965Sjdp 5233965Sjdp# Set newsrcdir to something subdirectories can use. 5333965Sjdpcase ${srcdir} in 5489857Sobrien/* | [A-Za-z]:[\\/]*) newsrcdir=${srcdir} ;; 5533965Sjdp*) newsrcdir=../${srcdir} ;; 5633965Sjdpesac 5733965Sjdp 5833965Sjdpfor f in `ls -a ${srcdir}`; do 5933965Sjdp if [ -d ${srcdir}/$f ]; then 6033965Sjdp found= 6133965Sjdp for i in ${ignore} ${ignore_additional}; do 6233965Sjdp if [ "$f" = "$i" ]; then 6333965Sjdp found=yes 6433965Sjdp fi 6533965Sjdp done 6633965Sjdp if [ -z "${found}" ]; then 6738889Sjdp echo "$f ..working in" 6833965Sjdp if [ -d $f ]; then true; else mkdir $f; fi 6933965Sjdp (cd $f; ${prog} ${newsrcdir}/$f "${ignore}") 7033965Sjdp fi 7133965Sjdp else 7238889Sjdp echo "$f ..linked" 7333965Sjdp rm -f $f 7433965Sjdp ln -s ${srcdir}/$f . 7533965Sjdp fi 7633965Sjdpdone 7733965Sjdp 7833965Sjdpexit 0 79