annotate gsm-fw/cfgmagic/functions @ 947:76149e0628ba

target-utils/Makefile: c139explore added
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Mon, 02 Nov 2015 18:11:53 +0000
parents 042c178ebac5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 target() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 if [ $# -lt 1 ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 echo "target setting: required argument missing" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 if [ -n "$TARGET" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 echo "Error: target specified more than once" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 if [ ! -f "cfgmagic/target.$1" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 echo "Error: target $1 not known" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 # looks good, proceed
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 TARGET="$1"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 . "cfgmagic/target.$1"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 . cfgmagic/post-target
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 feature() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 if [ $# -lt 1 ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 echo "feature setting: required argument missing" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 if [ -z "$TARGET" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 echo "Please specify the target before any features" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 if [ ! -f "cfgmagic/feature.$1" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 echo "Error: feature $1 not known" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 # looks good, proceed
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 . "cfgmagic/feature.$1"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42
942
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
43 allow_target_feature() {
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
44 while [ $# != 0 ]
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
45 do
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
46 case "$target_feature_list" in
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
47 *" $1 "* | *" $1")
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
48 ;;
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
49 *)
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
50 target_feature_list="$target_feature_list $1"
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
51 ;;
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
52 esac
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
53 shift
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
54 done
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
55 }
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
56
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
57 check_target_feature() {
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
58 while [ $# != 0 ]
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
59 do
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
60 case "$target_feature_list" in
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
61 *" $1 "* | *" $1" | *" OVERRIDE "* | *" OVERRIDE")
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
62 ;;
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
63 *)
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
64 echo "Error: feature $1 not supported on target $TARGET" 1>&2
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
65 exit 1
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
66 ;;
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
67 esac
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
68 shift
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
69 done
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
70 }
042c178ebac5 gsm-fw/cfgmagic: logic for target-dependent features streamlined a little
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 524
diff changeset
71
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 export_to_c() {
524
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
73 while [ $# != 0 ]
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
74 do
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
75 case "$c_export_list" in
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
76 *" $1 "* | *" $1")
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
77 ;;
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
78 *)
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
79 c_export_list="$c_export_list $1"
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
80 ;;
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
81 esac
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
82 shift
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
83 done
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 export_to_mk() {
524
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
87 while [ $# != 0 ]
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
88 do
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
89 case "$mk_export_list" in
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
90 *" $1 "* | *" $1")
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
91 ;;
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
92 *)
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
93 mk_export_list="$mk_export_list $1"
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
94 ;;
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
95 esac
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
96 shift
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
97 done
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100 export_to_m4() {
524
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
101 while [ $# != 0 ]
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
102 do
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
103 case "$m4_export_list" in
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
104 *" $1 "* | *" $1")
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
105 ;;
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
106 *)
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
107 m4_export_list="$m4_export_list $1"
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
108 ;;
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
109 esac
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
110 shift
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
111 done
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
112 }