comparison 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
comparison
equal deleted inserted replaced
87:321f6a9ae989 88:ccde45a06737
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 export_to_c() {
44 if [ $# != 1 ]
45 then
46 echo "export_to_c: wrong number of arguments" 1>&2
47 exit 1
48 fi
49 c_export_list="$c_export_list $1"
50 }
51
52 export_to_mk() {
53 if [ $# != 1 ]
54 then
55 echo "export_to_mk: wrong number of arguments" 1>&2
56 exit 1
57 fi
58 mk_export_list="$mk_export_list $1"
59 }
60
61 export_to_m4() {
62 if [ $# != 1 ]
63 then
64 echo "export_to_m4: wrong number of arguments" 1>&2
65 exit 1
66 fi
67 m4_export_list="$m4_export_list $1"
68 }