host driver: support access to the chip register wider then 8-bit.
[lincan.git] / build-lincan.sh
1 SOURCE_DIRS="lincan"
2 OMK_RULES_DIR=omk/rules/linux
3 BUILD_DIR=lincan-build/native
4
5 SOURCE_PATHS="$SOURCE_PATHS $SOURCE_DIRS $(echo $OMK_RULES_DIR/*)"
6
7 TOP_RELATIVE="$( echo "$BUILD_DIR" | sed -n -e 's#[^/]*/[^/]*#../#pg' ).."
8
9 echo "SOURCE_PATHS=$SOURCE_PATHS"
10 echo "TOP_RELATIVE=$TOP_RELATIVE"
11
12 mkdir -p "$BUILD_DIR" || exit 1
13
14 for i in $SOURCE_PATHS ; do
15   b="$(basename $i)"
16   if [ ! -e "$BUILD_DIR/$b" ] ; then
17     echo "$BUILD_DIR : ln -s $TOP_RELATIVE/$i $b"
18     ( cd "$BUILD_DIR" && ln -s "$TOP_RELATIVE/$i" "$b" ) || exit 1
19   fi
20 done
21
22 for i in $SOURCE_DIRS ; do
23   b="$(basename $i)"
24   if ! grep -s "\<$b\>" "$BUILD_DIR/Makefile.omk" ; then
25     echo "SUBDIRS += $b" >>"$BUILD_DIR/Makefile.omk" || exit 1
26   fi
27 done
28
29 if [ ! -e "$BUILD_DIR/Makefile" ] ; then
30   m=$OMK_RULES_DIR
31   if [ ! -e "$m/Makefile" ] ; then m="$(dirname $m)" ; fi
32   if [ ! -e "$m/Makefile" ] ; then m="$(dirname $m)" ; fi
33   if [ -e "$m/Makefile" ] ; then
34     cp -v "$m/Makefile" "$BUILD_DIR/Makefile"
35   fi
36 fi
37
38 ( cd "$BUILD_DIR" && make default-config ) || exit 1
39
40 ( cd "$BUILD_DIR" && make ) || exit 1