FreeCalypso > hg > freecalypso-sw
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/cfgmagic/processconf.sh Tue Nov 12 05:35:48 2013 +0000 @@ -0,0 +1,86 @@ +#!/bin/sh +# The top level Makefile invokes this Bourne shell script after ensuring +# that the build.conf file is present. The job of this script is to grok +# that configuration file and to produce include/config.{h,mk,m4} files +# corresponding to the selected configuration. +# +# The current directory is expected to be the top level of nuc-fw, i.e., +# all fragments are sourced as cfgmagic/blah. +# Don't run this script directly - let the Makefile do it for you. + +set -e +. cfgmagic/functions +TARGET= +c_export_list= +mk_export_list= +m4_export_list= + +# some defaults +RVTMUX_UART_port=IrDA +RVTMUX_UART_baud=115200 + +. ./build.conf + +if [ -z "$TARGET" ] +then + echo "Error: target not set in build.conf" 1>&2 + exit 1 +fi + +# Serial configuration +case "$RVTMUX_UART_port" in + IrDA) + ;; + MODEM) + CONFIG_RVTMUX_ON_MODEM=1 + export_to_c CONFIG_RVTMUX_ON_MODEM + ;; + *) + echo "Error: unknown RTVMUX_UART_port=$RTVMUX_UART_port" 1>&2 + exit 1 + ;; +esac + +TR_BAUD_CONFIG=TR_BAUD_$RVTMUX_UART_baud +export_to_c TR_BAUD_CONFIG + +# Once we get some actual functionality, the following definitions +# will likely depend on the target and feature configuration, +# but for now all we have is a Riviera skeleton. + +BUILD_COMPONENTS="bsp nucleus riviera serial sprintf sysglue" +export_to_mk BUILD_COMPONENTS + +BUILD_DEFAULT_IMAGE=ramImage +export_to_mk BUILD_DEFAULT_IMAGE + +# Now generate the output files! + +parse_export_list() { + for var in $1 + do + eval "value=\"\$$var\"" + emit_def "$var" "$value" + done +} + +# make config.h +emit_def() { + echo "#define $1 $2" >> include/config.h +} +: > include/config.h +parse_export_list "$c_export_list" + +# make config.mk +emit_def() { + echo "$1= $2" >> include/config.mk +} +: > include/config.mk +parse_export_list "$mk_export_list" + +# make config.m4 +emit_def() { + echo 'define(`'"$1'"',`'"$2')dnl" >> include/config.m4 +} +: > include/config.m4 +parse_export_list "$m4_export_list"