#!/bin/sh
-
+PYTHON=python
# Target build script
if [ $# -lt 1 ]; then
fi
target_dir=$lbpath/targets
-config_lb=$1/Config.lb
-config_py=$lbpath/util/newconfig/config.py
+config_lb=$1
+config_dir=$lbpath/util/newconfig
+yapps2_py=$config_dir/yapps2.py
+config_g=$config_dir/config.g
if [ ! -d $target_dir ]; then
echo "Target directory not found"
cd $target_dir
+if [ ! -f $config_lb ]; then
+ config_lb=$1/Config.lb
+fi
if [ ! -f $config_lb ]; then
echo "No target config file found"
+ echo "Tried both $1 and $config_lb"
exit 1
fi
+build_dir=`dirname $config_lb`/`sed -n -e 's/^target \(.*\)$/\1/p' $config_lb`
+echo "build_dir=$build_dir"
+config_py=$build_dir/config.py
+
+if [ ! -d $build_dir ] ; then
+ mkdir -p $build_dir
+fi
if [ ! -f $config_py ]; then
- echo "No linuxbios config file found"
- exit 1
+ echo "No linuxbios config script found. Rebuilding it.."
+ $PYTHON $yapps2_py $config_g $config_py
fi
-python $config_py $config_lb $lbpath
+# make sure config.py is up-to-date
+
+export PYTHONPATH=$config_dir
+$PYTHON $config_py $config_lb $lbpath
exit $?