Merge: repair: sh7760 cannot be loaded as modules (Wrong params)
[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_DIRS"
6 SOURCE_PATHS+=" $(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   cp omk/Makefile "$BUILD_DIR/Makefile"
32 fi
33
34 ( cd "$BUILD_DIR" && make default-config ) || exit 1
35
36 ( cd "$BUILD_DIR" && make ) || exit 1