comparison gsm-fw/cfgmagic/processconf.sh @ 143:afceeeb2cba1

Our nuc-fw is destined to become gsm-fw, so I went ahead and did the big hg mv
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Tue, 12 Nov 2013 05:35:48 +0000
parents nuc-fw/cfgmagic/processconf.sh@85994b210f6a
children df335d255ac4
comparison
equal deleted inserted replaced
142:15d5977390c2 143:afceeeb2cba1
1 #!/bin/sh
2 # The top level Makefile invokes this Bourne shell script after ensuring
3 # that the build.conf file is present. The job of this script is to grok
4 # that configuration file and to produce include/config.{h,mk,m4} files
5 # corresponding to the selected configuration.
6 #
7 # The current directory is expected to be the top level of nuc-fw, i.e.,
8 # all fragments are sourced as cfgmagic/blah.
9 # Don't run this script directly - let the Makefile do it for you.
10
11 set -e
12 . cfgmagic/functions
13 TARGET=
14 c_export_list=
15 mk_export_list=
16 m4_export_list=
17
18 # some defaults
19 RVTMUX_UART_port=IrDA
20 RVTMUX_UART_baud=115200
21
22 . ./build.conf
23
24 if [ -z "$TARGET" ]
25 then
26 echo "Error: target not set in build.conf" 1>&2
27 exit 1
28 fi
29
30 # Serial configuration
31 case "$RVTMUX_UART_port" in
32 IrDA)
33 ;;
34 MODEM)
35 CONFIG_RVTMUX_ON_MODEM=1
36 export_to_c CONFIG_RVTMUX_ON_MODEM
37 ;;
38 *)
39 echo "Error: unknown RTVMUX_UART_port=$RTVMUX_UART_port" 1>&2
40 exit 1
41 ;;
42 esac
43
44 TR_BAUD_CONFIG=TR_BAUD_$RVTMUX_UART_baud
45 export_to_c TR_BAUD_CONFIG
46
47 # Once we get some actual functionality, the following definitions
48 # will likely depend on the target and feature configuration,
49 # but for now all we have is a Riviera skeleton.
50
51 BUILD_COMPONENTS="bsp nucleus riviera serial sprintf sysglue"
52 export_to_mk BUILD_COMPONENTS
53
54 BUILD_DEFAULT_IMAGE=ramImage
55 export_to_mk BUILD_DEFAULT_IMAGE
56
57 # Now generate the output files!
58
59 parse_export_list() {
60 for var in $1
61 do
62 eval "value=\"\$$var\""
63 emit_def "$var" "$value"
64 done
65 }
66
67 # make config.h
68 emit_def() {
69 echo "#define $1 $2" >> include/config.h
70 }
71 : > include/config.h
72 parse_export_list "$c_export_list"
73
74 # make config.mk
75 emit_def() {
76 echo "$1= $2" >> include/config.mk
77 }
78 : > include/config.mk
79 parse_export_list "$mk_export_list"
80
81 # make config.m4
82 emit_def() {
83 echo 'define(`'"$1'"',`'"$2')dnl" >> include/config.m4
84 }
85 : > include/config.m4
86 parse_export_list "$m4_export_list"