summaryrefslogtreecommitdiff
path: root/scripts/create-menu
blob: 3624776e770c2bb4dfa3d2134469882b77a94183 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# This file is part of the OpenADK project. OpenADK is copyrighted
# material, please see the LICENCE file in the top-level directory.

topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
systems=$(grep -h config target/*/systems/*|cut -d " " -f 2)

printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch
printf "source target/config/Config.in.arch.default\n" >> target/config/Config.in.arch
printf "source target/config/Config.in.arch.choice\n" >> target/config/Config.in.arch
printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system
printf "source target/config/Config.in.system.default\n" >> target/config/Config.in.system
printf "source target/config/Config.in.system.choice\n" >> target/config/Config.in.system

# update appliances
if [ -d "$topdir/target/appliances" ];then
	printf "# autogenerated via scripts/create-menu\n" > $topdir/target/config/Config.in.appliances
	printf "choice\n" >> $topdir/target/config/Config.in.appliances
	printf "prompt \"Appliance\"\n\n" >> $topdir/target/config/Config.in.appliances
	printf "config ADK_CHOOSE_APPLIANCE\n" >> $topdir/target/config/Config.in.appliances
	printf "\tprompt \"choose an appliance\"\n" >> $topdir/target/config/Config.in.appliances
	printf "\tbool\n\n" >> $topdir/target/config/Config.in.appliances
	cat $topdir/target/appliances/*.appliance >> $topdir/target/config/Config.in.appliances 2>/dev/null
	printf "\nendchoice\n\n" >> $topdir/target/config/Config.in.appliances
	printf "menu \"Appliance Options\"\n" >> $topdir/target/config/Config.in.appliances
	printf "\tvisible if !ADK_CHOOSE_APPLIANCE\n" >> $topdir/target/config/Config.in.appliances
	cat $topdir/target/appliances/*.options >> $topdir/target/config/Config.in.appliances 2>/dev/null
	printf "endmenu\n" >> $topdir/target/config/Config.in.appliances
fi

# create system default
printf "# autogenerated via scripts/create-menu\n" > $topdir/target/config/Config.in.system.default

cat >> $topdir/target/config/Config.in.system.default << EOD
config ADK_TARGET_SYSTEM
	string
EOD
for i in $systems;do
	system=${i#ADK_TARGET_SYSTEM_}
	systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
	system=$(echo $system|tr '[:upper:]_' '[:lower:]-')
	system=$(echo $system|sed 's#x86-64#x86_64#')
	printf "\tdefault \"${system}\" if $i\n" >> $topdir/target/config/Config.in.system.default
done

# create or update systems
for i in $(ls $topdir/target/);do
	if [ -d "$topdir/target/$i/systems" ];then
		cat $topdir/target/$i/systems/* > $topdir/target/$i/Config.in.systems 2>/dev/null
	fi
done

# create target/$arch/Config.in.arch and target/config/Config.in.system.choice
printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system.choice
printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch.default
for arch in $(cat $topdir/target/arch.lst);do
	ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
	printf "choice\n" > $topdir/target/$arch/Config.in.arch
	printf "prompt \"Embedded system\"\n" >> $topdir/target/$arch/Config.in.arch
	printf "depends on ADK_TARGET_ARCH_$ARCH\n" >> $topdir/target/$arch/Config.in.arch
	printf "source target/$arch/Config.in.systems\n" >> $topdir/target/$arch/Config.in.arch
	printf "endchoice\n" >> $topdir/target/$arch/Config.in.arch
	printf "source target/$arch/Config.in.arch\n" >> target/config/Config.in.system.choice
done

cat >> $topdir/target/config/Config.in.arch.default << EOD
config ADK_TARGET_ARCH
	string
EOD

for arch in $(cat $topdir/target/arch.lst);do
	ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
	printf "\tdefault \"$arch\" if ADK_TARGET_ARCH_$ARCH\n" >> target/config/Config.in.arch.default
done

cat > $topdir/target/config/Config.in.arch.choice << EOD
# autogenerated via scripts/create-menu
choice
prompt "Architecture"

EOD

for arch in $(cat $topdir/target/arch.lst);do
	ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
	printf "config ADK_TARGET_ARCH_$ARCH\n" >> $topdir/target/config/Config.in.arch.choice
	printf "\tbool \"$arch system\"\n" >> $topdir/target/config/Config.in.arch.choice
	printf "\thelp\n" >> $topdir/target/config/Config.in.arch.choice
	printf "\t  Support for $ARCH systems.\n\n" >> $topdir/target/config/Config.in.arch.choice
done
printf "endchoice\n" >> $topdir/target/config/Config.in.arch.choice
exit 0