jehanne/arch/rc/cmd/build

38 lines
1.0 KiB
Bash

#!/cmd/rc
# This script run the rc build scripts passed as arguments
# after moving in their directory.
#
# If passed a directory, it will look for a build script named
# `{basename $PWD}.rc.build and run it instead.
#
# If invoked with no arguments it will assume $PWD as argument
#
# NOTE: this script is run both fron Jehanne and from UNIX during
# cross compilation (through the sh wrapper in hacking/bin/build)
# thus it should not explicitly check $status as exit codes
# work differently in UNIX and Jehanne.
args=$*
if (~ $#args 0)
args=$PWD
for (script in $args){
if (test -d $script){
if (~ $script $JEHANNE){
target=jehanne
}
if not {
target=`{basename $script}
}
rundir=$script
script=$target.rc.build
}
if not {
rundir=`{dirname $script}
script=`{basename $script}
}
echo $rundir/$script
@{cd $rundir; . $JEHANNE/arch/rc/lib/build/utils.rc; cat $script|rc -v -e >[2=1]|sed 's/^/ /'}
}