findutils: fix compile with debugging options
[openadk.git] / scripts / update-sys
blobbcfbfa84eacae6f5675f8a95d689eb2397a2ae0b
1 #!/usr/bin/env bash
2 #set -x
3 # 1. create Config.in.systems with all available target systems for each architecture
4 # 2. if ADK configuration exist, create Config.in.arch/Config.in.system with fixed values
5 # 3. exit when native system build is detected
7 topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
9 defaults() {
10 echo 'source "target/config/Config.in.arch.default"' > $topdir/target/config/Config.in.arch
11 echo 'source "target/config/Config.in.arch.choice"' >> $topdir/target/config/Config.in.arch
12 echo 'source "target/config/Config.in.system.default"' > $topdir/target/config/Config.in.system
13 echo 'source "target/config/Config.in.system.choice"' >> $topdir/target/config/Config.in.system
14 exit 0
17 check_native() {
18 native=$(grep ^ADK_LINUX_NATIVE $topdir/.config)
19 if [ ! -z "$native" ];then
20 exit 0
24 touch $topdir/target/config/Config.in.native
26 for i in $(ls $topdir/target/);do
27 if [ -d "$topdir/target/$i/sys-enabled" ];then
28 cat $topdir/target/$i/sys-enabled/* > $topdir/target/$i/Config.in.systems 2>/dev/null
30 done
31 if [ -f $topdir/.config ];then
33 check_native
35 arch=$(grep ^ADK_TARGET_ARCH $topdir/.config|cut -f 2 -d = | sed -e 's#"##g')
36 cpuarch=$(grep ^ADK_TARGET_CPU_ARCH $topdir/.config|cut -f 2 -d = | sed -e 's#"##g')
37 systemsym=$(grep ^ADK_TARGET_SYSTEM_ $topdir/.config|cut -f 1 -d =)
38 system=$(grep ^ADK_TARGET_SYSTEM= $topdir/.config|cut -f 2 -d = | sed -e 's#"##g')
39 systems=$(grep ^ADK_TARGET_SYSTEM= $topdir/.config|cut -f 2 -d = | sed -e 's#"##g'|sed -e 's#-#_#g')
40 archsym=$(echo ADK_LINUX_$arch|tr '[:lower:]' '[:upper:]')
42 if [ -z "$arch" -o -z "$system" ];then
43 defaults
46 cat > $topdir/target/config/Config.in.arch << EOF
47 source "target/config/Config.in.arch.default"
48 config $archsym
49 boolean
50 EOF
52 if [ "${system}" = "toolchain" -o "${system}" = "qemu" ];then
53 sys=${system}-$cpuarch
54 else
55 sys=$system
58 cat > $topdir/target/config/Config.in.system << EOF
59 source "target/config/Config.in.system.default"
60 comment "Architecture: $arch"
61 comment "CPU Architecture: $cpuarch"
62 comment "System: $sys"
64 config $systemsym
65 boolean
66 select $archsym
67 $(grep select $topdir/target/$arch/sys-available/$sys)
68 default y
69 EOF
70 else
71 defaults
73 exit 0