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