musl: update to 1.1.18
[openadk.git] / scripts / create-menu
blob3c0d87ca9509aa0dff68895bb2fdc974c860561d
1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
5 systems=$(grep -h config target/*/systems/*|cut -d " " -f 2)
7 printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch
8 printf "source target/config/Config.in.arch.default\n" >> target/config/Config.in.arch
9 printf "source target/config/Config.in.arch.choice\n" >> target/config/Config.in.arch
10 printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system
11 printf "source target/config/Config.in.system.default\n" >> target/config/Config.in.system
12 printf "source target/config/Config.in.system.choice\n" >> target/config/Config.in.system
14 # update tasks
15 if [ -d "$topdir/tasks" ];then
16         printf "# autogenerated via scripts/create-menu\n" > $topdir/target/config/Config.in.tasks
17         printf "menu \"Tasks\"\n" >> $topdir/target/config/Config.in.tasks
18         printf "\tvisible if ADK_TARGET_OS_LINUX && !ADK_TARGET_CHOOSE_ARCH\n\n" >> $topdir/target/config/Config.in.tasks
19         cat $topdir/tasks/* >> $topdir/target/config/Config.in.tasks 2>/dev/null
20         printf "\nendmenu\n\n" >> $topdir/target/config/Config.in.tasks
23 # create system default
24 printf "# autogenerated via scripts/create-menu\n" > $topdir/target/config/Config.in.system.default
26 cat >> $topdir/target/config/Config.in.system.default << EOD
27 config ADK_TARGET_SYSTEM
28         string
29 EOD
30 for i in $systems;do
31         system=${i#ADK_TARGET_SYSTEM_}
32         systemu=$(echo $system|tr '[:upper:]' '[:lower:]')
33         system=$(echo $system|tr '[:upper:]_' '[:lower:]-')
34         system=$(echo $system|sed 's#x86-64#x86_64#')
35         printf "\tdefault \"${system}\" if $i\n" >> $topdir/target/config/Config.in.system.default
36 done
38 # create or update systems
39 for arch in $(cat $topdir/target/arch.lst);do
40         ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
41         printf "config ADK_TARGET_SYSTEM_GENERIC_$ARCH\n" > $topdir/target/$arch/Config.in.systems
42         printf "\tbool \"Generic\"\n" >> $topdir/target/$arch/Config.in.systems
43         printf "\tselect ADK_TARGET_GENERIC\n" >> $topdir/target/$arch/Config.in.systems
44         printf "\thelp\n" >> $topdir/target/$arch/Config.in.systems
45         printf "\t  Generic $ARCH system.\n\n" >> $topdir/target/$arch/Config.in.systems
46         printf "\tdefault \"generic-${arch}\" if ADK_TARGET_SYSTEM_GENERIC_$ARCH\n" >> $topdir/target/config/Config.in.system.default
47 done
49 for i in $(ls $topdir/target/);do
50         if [ -d "$topdir/target/$i/systems" ];then
51                 cat $topdir/target/$i/systems/* >> $topdir/target/$i/Config.in.systems 2>/dev/null
52         fi
53 done
55 # create target/$arch/Config.in.arch and target/config/Config.in.system.choice
56 printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.system.choice
57 printf "# autogenerated via scripts/create-menu\n" > target/config/Config.in.arch.default
58 for arch in $(cat $topdir/target/arch.lst);do
59         ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
60         printf "choice\n" > $topdir/target/$arch/Config.in.arch
61         printf "prompt \"System\"\n" >> $topdir/target/$arch/Config.in.arch
62         printf "depends on ADK_TARGET_ARCH_$ARCH\n" >> $topdir/target/$arch/Config.in.arch
63         printf "source target/$arch/Config.in.systems\n" >> $topdir/target/$arch/Config.in.arch
64         printf "endchoice\n" >> $topdir/target/$arch/Config.in.arch
65         printf "source target/$arch/Config.in.arch\n" >> target/config/Config.in.system.choice
66 done
68 cat >> $topdir/target/config/Config.in.arch.default << EOD
69 config ADK_TARGET_ARCH
70         string
71 EOD
73 for arch in $(cat $topdir/target/arch.lst);do
74   ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
75   printf "\tdefault \"$arch\" if ADK_TARGET_ARCH_$ARCH\n" >> target/config/Config.in.arch.default
76 done
77 printf "\n\n" >> target/config/Config.in.arch.default
79 for arch in $(cat $topdir/target/arch.lst);do
80   ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
81   printf "config ADK_TARGET_ARCH_${ARCH}\n" >> $topdir/target/config/Config.in.arch.default
82   printf "\tbool\n\n" >> $topdir/target/config/Config.in.arch.default
83 done
85 cat > $topdir/target/config/Config.in.arch.choice << EOD
86 # autogenerated via scripts/create-menu
87 choice
88 prompt "Architecture"
90 config ADK_TARGET_CHOOSE_ARCH
91         bool "choose architecture"
93 EOD
94 for os in linux frosted baremetal; do
95   for arch in $(cat $topdir/target/$os/arch.lst);do
96     OS=$(echo $os | tr '[:lower:]' '[:upper:]')
97     ARCH=$(echo $arch | tr '[:lower:]' '[:upper:]')
98     printf "config ADK_TARGET_${OS}_ARCH_${ARCH}\n" >> $topdir/target/config/Config.in.arch.choice
99     printf "\tbool \"$arch\"\n" >> $topdir/target/config/Config.in.arch.choice
100     printf "\tdepends on ADK_TARGET_OS_${OS}\n" >> $topdir/target/config/Config.in.arch.choice
101     printf "\tselect ADK_TARGET_ARCH_${ARCH}\n" >> $topdir/target/config/Config.in.arch.choice
102     printf "\thelp\n" >> $topdir/target/config/Config.in.arch.choice
103     printf "\t  Support for $ARCH systems.\n\n" >> $topdir/target/config/Config.in.arch.choice
104   done
105 done
106 printf "endchoice\n" >> $topdir/target/config/Config.in.arch.choice
108 exit 0