FreeCalypso > hg > freecalypso-citrine
comparison cfgmagic/functions @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 09 Jun 2016 00:02:41 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:75a11d740a02 |
|---|---|
| 1 target() { | |
| 2 if [ $# -lt 1 ] | |
| 3 then | |
| 4 echo "target setting: required argument missing" 1>&2 | |
| 5 exit 1 | |
| 6 fi | |
| 7 if [ -n "$TARGET" ] | |
| 8 then | |
| 9 echo "Error: target specified more than once" 1>&2 | |
| 10 exit 1 | |
| 11 fi | |
| 12 if [ ! -f "cfgmagic/target.$1" ] | |
| 13 then | |
| 14 echo "Error: target $1 not known" 1>&2 | |
| 15 exit 1 | |
| 16 fi | |
| 17 # looks good, proceed | |
| 18 TARGET="$1" | |
| 19 . "cfgmagic/target.$1" | |
| 20 . cfgmagic/post-target | |
| 21 } | |
| 22 | |
| 23 feature() { | |
| 24 if [ $# -lt 1 ] | |
| 25 then | |
| 26 echo "feature setting: required argument missing" 1>&2 | |
| 27 exit 1 | |
| 28 fi | |
| 29 if [ -z "$TARGET" ] | |
| 30 then | |
| 31 echo "Please specify the target before any features" 1>&2 | |
| 32 exit 1 | |
| 33 fi | |
| 34 if [ ! -f "cfgmagic/feature.$1" ] | |
| 35 then | |
| 36 echo "Error: feature $1 not known" 1>&2 | |
| 37 exit 1 | |
| 38 fi | |
| 39 # looks good, proceed | |
| 40 . "cfgmagic/feature.$1" | |
| 41 } | |
| 42 | |
| 43 allow_target_feature() { | |
| 44 while [ $# != 0 ] | |
| 45 do | |
| 46 case "$target_feature_list" in | |
| 47 *" $1 "* | *" $1") | |
| 48 ;; | |
| 49 *) | |
| 50 target_feature_list="$target_feature_list $1" | |
| 51 ;; | |
| 52 esac | |
| 53 shift | |
| 54 done | |
| 55 } | |
| 56 | |
| 57 check_target_feature() { | |
| 58 while [ $# != 0 ] | |
| 59 do | |
| 60 case "$target_feature_list" in | |
| 61 *" $1 "* | *" $1" | *" OVERRIDE "* | *" OVERRIDE") | |
| 62 ;; | |
| 63 *) | |
| 64 echo "Error: feature $1 not supported on target $TARGET" 1>&2 | |
| 65 exit 1 | |
| 66 ;; | |
| 67 esac | |
| 68 shift | |
| 69 done | |
| 70 } | |
| 71 | |
| 72 export_to_c() { | |
| 73 while [ $# != 0 ] | |
| 74 do | |
| 75 case "$c_export_list" in | |
| 76 *" $1 "* | *" $1") | |
| 77 ;; | |
| 78 *) | |
| 79 c_export_list="$c_export_list $1" | |
| 80 ;; | |
| 81 esac | |
| 82 shift | |
| 83 done | |
| 84 } | |
| 85 | |
| 86 export_to_mk() { | |
| 87 while [ $# != 0 ] | |
| 88 do | |
| 89 case "$mk_export_list" in | |
| 90 *" $1 "* | *" $1") | |
| 91 ;; | |
| 92 *) | |
| 93 mk_export_list="$mk_export_list $1" | |
| 94 ;; | |
| 95 esac | |
| 96 shift | |
| 97 done | |
| 98 } | |
| 99 | |
| 100 export_to_m4() { | |
| 101 while [ $# != 0 ] | |
| 102 do | |
| 103 case "$m4_export_list" in | |
| 104 *" $1 "* | *" $1") | |
| 105 ;; | |
| 106 *) | |
| 107 m4_export_list="$m4_export_list $1" | |
| 108 ;; | |
| 109 esac | |
| 110 shift | |
| 111 done | |
| 112 } |
