Added script to setup embedded-build/can-usb1 directory and starting build of CAN...
authorppisa <pisa@cmp.felk.cvut.cz>
Sun, 6 Jul 2008 09:10:07 +0000 (11:10 +0200)
committerppisa <pisa@cmp.felk.cvut.cz>
Sun, 6 Jul 2008 09:10:00 +0000 (11:10 +0200)
Signed-off-by: ppisa <pisa@cmp.felk.cvut.cz>
build-embedded.sh [new file with mode: 0755]

diff --git a/build-embedded.sh b/build-embedded.sh
new file mode 100755 (executable)
index 0000000..09e10cc
--- /dev/null
@@ -0,0 +1,41 @@
+SOURCE_DIRS="embedded/app embedded/arch embedded/board embedded/libs4c"
+OMK_RULES_DIR=omk/rules/sysless
+BUILD_DIR=embedded-build/can-usb1
+OMK_CONFIG=embedded/board/arm/ul_usb1/config/config.usbcan
+
+SOURCE_PATHS+=" $SOURCE_DIRS"
+SOURCE_PATHS+=" $(echo $OMK_RULES_DIR/*)"
+
+TOP_RELATIVE="$( echo "$BUILD_DIR" | sed -n -e 's#[^/]*/[^/]*#../#pg' ).."
+
+echo "SOURCE_PATHS=$SOURCE_PATHS"
+echo "TOP_RELATIVE=$TOP_RELATIVE"
+
+mkdir -p "$BUILD_DIR" || exit 1
+
+for i in $SOURCE_PATHS ; do
+  b="$(basename $i)"
+  if [ ! -e "$BUILD_DIR/$b" ] ; then
+    echo "$BUILD_DIR : ln -s $TOP_RELATIVE/$i $b"
+    ( cd "$BUILD_DIR" && ln -s "$TOP_RELATIVE/$i" "$b" ) || exit 1
+  fi
+done
+
+for i in $SOURCE_DIRS ; do
+  b="$(basename $i)"
+  if ! grep -s "\<$b\>" "$BUILD_DIR/Makefile.omk" ; then
+    echo "SUBDIRS += $b" >>"$BUILD_DIR/Makefile.omk" || exit 1
+  fi
+done
+
+if [ ! -e "$BUILD_DIR/Makefile" ] ; then
+  cp omk/Makefile "$BUILD_DIR/Makefile"
+fi
+
+if [ ! -e "$BUILD_DIR/config.omk" ] ; then
+  ( cd "$BUILD_DIR" && ln -s "$TOP_RELATIVE/$OMK_CONFIG" config.omk )
+fi
+
+( cd "$BUILD_DIR" && make default-config ) || exit 1
+
+( cd "$BUILD_DIR" && make ) || exit 1