1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
#!/bin/sh
SYM_OPT="-s"
if [ "$1" = "--quiet" ]
then
opt_quiet=1
else
opt_quiet=0
fi
#
# Check out how we can do an echo without a newline
#
if echo '\c' | grep -s c >/dev/null 2>&1
then
ECHO_N="echo -n"
ECHO_C=""
else
ECHO_N="echo"
ECHO_C='\c'
fi
#
# Work out the target and see if there's a directory there already
#
echo
TARG=`scripts/sys-arch`
if test -d targets/${TARG}
then
${ECHO_N} "Target directory for ${TARG} exists! ${ECHO_C}"
if [ $opt_quiet -eq 1 ]
then
exit 0
else
${ECHO_N} "Clear it? [y/n] ${ECHO_C} "
read ANS
if test ${ANS}"." = "y."
then
echo "Clearing old target directory for ${TARG}"
rm -rf targets/${TARG}
else
echo
echo "OK. I'll fill the gaps (there will be warnings)"
echo
fi
fi
fi
#
# Build the target dir
#
if test ! -d targets
then
mkdir targets
fi
mkdir targets/${TARG}
mkdir targets/${TARG}/lib
echo
echo Making target directory for ${TARG}
cd targets/${TARG}
echo
echo Building directory tree.
for DIR in `find ../../src ! -name CVS -type d -print | sed "s,^../../src/,,"`
do
if test ${DIR} != "../../src"
then
echo " Adding $DIR"
mkdir ${DIR}
fi
done
echo
echo Adding sym-links
for FILE in `find ../../src ! -type d -print | grep -v "/CVS/" | sed "s,^../../src/,,"`
do
${ECHO_N} ".${ECHO_C}"
OFFSET=`echo $FILE | sed "s,[^/],,g" | sed "s,/,../,g"`
ln ${SYM_OPT} ../../$OFFSET/src/$FILE $FILE ;\
done
echo $TARG > conf/target
echo
echo; echo Build of target directory for $TARG complete
echo
|