Added script to build LinCAN project independent of OCERA tree.
authorppisa <pisa@cmp.felk.cvut.cz>
Thu, 11 Nov 2004 18:21:49 +0000 (19:21 +0100)
committerppisa <pisa@cmp.felk.cvut.cz>
Fri, 31 Oct 2008 21:54:06 +0000 (22:54 +0100)
The code represented in this repository is in directory is based
on the LinCAN (ocera/components/comm/can/lincan directory) component
from OCERA (IST-2001 35102) project. Original project documentation
can be found there
  http://www.ocera.org/download/components/WP7/index.html
  http://sourceforge.net/projects/ocera/
  http://ocera.cvs.sourceforge.net/ocera/ocera/components/comm/can/

Can related components CVS repository can be accessed by
  cvs -d:pserver:anonymous@ocera.cvs.sourceforge.net:/cvsroot/ocera login
  cvs -z3 -d:pserver:anonymous@ocera.cvs.sourceforge.net:/cvsroot/ocera co ocera/components/comm/can

The original code depend on OCERA make system. The minimal set of OMK <http://rtime.felk.cvut.cz/omk/>
rules has been introduced in the previous changeset to make this project independent
of full OCERA repository.

The scrip "build-lincan.sh" prepares "lincan-build/native" directory and links
OMK rules and unmodified LinCAN directory there. Then it builds native version
of the driver for current running kernel. Resulting driver can be found
in directory
  lincan-build/native/_compiled/modules
Utilities binaries are located in directories listed bellow
  lincan-build/native/_compiled/bin
  lincan-build/native/_compiled/bin-utils

build-lincan.sh [new file with mode: 0755]

diff --git a/build-lincan.sh b/build-lincan.sh
new file mode 100755 (executable)
index 0000000..406af34
--- /dev/null
@@ -0,0 +1,36 @@
+SOURCE_DIRS="lincan"
+OMK_RULES_DIR=omk/rules/linux
+BUILD_DIR=lincan-build/native
+
+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
+
+( cd "$BUILD_DIR" && make default-config ) || exit 1
+
+( cd "$BUILD_DIR" && make ) || exit 1