#!/bin/sh
-if [ -z "$1" ]; then
- echo "Usage: linkarch <arch directory>"
- exit 1;
-fi
-
-ARCH_DIR=$1
-
-ARCH_DIR=`cd $ARCH_DIR; pwd`
+# This script recursively creates links to files from common directory
+# in the current tree.
function make_links
{
- DIR=$1
- if [ ! -d $DIR ]; then
- echo "Can't find $DIR in current directory";
+ SRC_DIR=$1
+ if [ ! -d $SRC_DIR ]; then
+ echo "Error: Can't find $SRC_DIR in current directory";
exit 1;
fi
- if [ ! -d $ARCH_DIR/$DIR ]; then
- echo "Warning: Can't find $ARCH_DIR/$DIR directory";
- return
- fi
-
- for f in $ARCH_DIR/$DIR/*; do
- [ ! -f $DIR/`basename $f` -a ! -L $DIR/`basename $f` ] && ln -s `echo $f|sed 's!//!/!'` $DIR/`basename $f`
+ for f in $SRC_DIR/*; do
+ bf=`basename $f`
+ if [ ! -e $bf ]; then
+ ln -sf $f $bf
+ else
+ if [ -d $bf -a ! -L $bf ]; then
+ (cd $bf; make_links ../$f)
+ fi
+ fi
done
}
-make_links app
-make_links arch
-make_links board
-make_links libs4c
-make_links doc
+# Maybe we should delete existing links
+#find -lname '*common/*'
+
+make_links common