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