comparison scripts/config-one.sh @ 9:227e8621dcf2

scripts/config-one.sh put together
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 15 May 2020 03:36:42 +0000
parents
children
comparison
equal deleted inserted replaced
8:727914266f28 9:227e8621dcf2
1 #!/bin/sh
2
3 set -e
4
5 # start looking at our invokation line
6
7 if [ "$1" = --clean ]
8 then
9 clean_flag=1
10 shift
11 else
12 clean_flag=0
13 fi
14
15 if [ $# != 2 ]
16 then
17 echo "usage: $0 [--clean] target uart" 1>&2
18 exit 1
19 fi
20
21 TARGET="$1"
22 UART_SEL="$2"
23
24 if [ ! -f "targets/$TARGET.h" ]
25 then
26 echo "Error: target $TARGET not known" 1>&2
27 exit 1
28 fi
29
30 case "$UART_SEL" in
31 irda)
32 RVTMUX_ON_MODEM=0
33 ;;
34 modem)
35 RVTMUX_ON_MODEM=1
36 ;;
37 *)
38 echo "Error: UART selection $UART_SEL not understood" 1>&2
39 exit 1
40 esac
41
42 BUILD_DIR="build-$TARGET-$UART_SEL"
43
44 echo "Building FFS editor for target $TARGET (UART $UART_SEL) in $BUILD_DIR"
45
46 if [ "$clean_flag" = 1 ]
47 then
48 rm -rf $BUILD_DIR
49 fi
50 mkdir -p $BUILD_DIR
51
52 # shell functions to be used in the configuration recipe
53
54 build_lib() {
55 if [ $# != 1 ]
56 then
57 echo "Error: build_lib takes 1 argument" 1>&2
58 exit 1
59 fi
60 scripts/mk-component.sh "$1"
61 SUBDIR="$SUBDIR $1"
62 LIBS="$LIBS $1/$1.a"
63 }
64
65 # invoke the configuration recipe
66
67 export BUILD_DIR TARGET RVTMUX_ON_MODEM
68
69 rm -rf $BUILD_DIR/config
70 cp -r cfg-headers $BUILD_DIR/config
71 cp targets/$TARGET.h $BUILD_DIR/config/fc-target.h
72
73 SUBDIR=
74 LIBS=
75
76 # core drivers
77 build_lib drivers_flash
78
79 build_lib riviera_core_flash
80 build_lib riviera_cust_flash
81
82 # services
83 build_lib dar
84 build_lib etm
85
86 # app drivers
87 build_lib buzzer
88 build_lib ffs
89 build_lib ffs_drv
90 build_lib uart_drv
91
92 # system glue
93 build_lib main
94 build_lib main_ir
95
96 # Nucleus
97 build_lib nucleus_flash
98 build_lib nucleus_intram
99
100 # selective libc replacement
101 build_lib libsys_fl
102 build_lib libsys_ir
103
104 # generate the top level Makefile!
105
106 helpers/makeline def SUBDIR $SUBDIR >> $BUILD_DIR/Makefile
107 echo >> $BUILD_DIR/Makefile
108 helpers/makeline def LIBS $LIBS >> $BUILD_DIR/Makefile
109 echo >> $BUILD_DIR/Makefile
110
111 cat gcc/makefile-body >> $BUILD_DIR/Makefile
112
113 # All done!
114
115 echo "Run make in $BUILD_DIR to compile the application"