annotate nuc-fw/cfgmagic/functions @ 88:ccde45a06737

nuc-fw: beginning of the configuration mechanism
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 23 Aug 2013 02:02:59 +0000
parents
children 3641e44f044e
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
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 export_to_c() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 if [ $# != 1 ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 echo "export_to_c: wrong number of arguments" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 c_export_list="$c_export_list $1"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 export_to_mk() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 if [ $# != 1 ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 echo "export_to_mk: wrong number of arguments" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 mk_export_list="$mk_export_list $1"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 export_to_m4() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 if [ $# != 1 ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 echo "export_to_m4: wrong number of arguments" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 m4_export_list="$m4_export_list $1"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 }