2 # Which config to use when updating the sizes in "official"
3 # source tree? I am using x86 glibc toolchain of some typical distro,
4 # not-static build, 32-bit defconfig build:
5 # # CONFIG_STATIC is not set
6 # CONFIG_CROSS_COMPILER_PREFIX=""
7 # CONFIG_EXTRA_CFLAGS="-m32"
8 # CONFIG_EXTRA_LDFLAGS="-m32"
10 # The list of all applet config symbols
11 test -f include/applets.h || { echo "No include/applets.h file"; exit 1; }
13 grep ^IF_ include/applets.h \
14 | grep -v ^IF_FEATURE_ \
15 | sed 's/IF_\([A-Z0-9._-]*\)(.*/\1/' \
19 test $# = 0 && set -- $apps
24 test -f "$b" || continue
25 text=`size "$b" | tail -1 | sed -e's/\t/ /g' -e's/^ *//' -e's/ .*//'`
26 #echo "text from $app: $text"
27 test x"${text//[0123456789]/}" = x"" || {
28 echo "Can't get: size $b"
31 test $mintext -gt $text && {
33 echo "# New mintext from $app: $mintext"
35 eval "text_${app}=$text"
40 test -f "$b" || continue
41 eval "text=\$text_${app}"
42 echo "# $app adds $((text-mintext))"
45 grep ^IF_ include/applets.h \
46 | grep -v ^IF_FEATURE_ \
50 | sed 's/(APPLET(/(/' \
51 | sed 's/(APPLET_[A-Z]*(/(/' \
52 | sed 's/(IF_[A-Z_]*(/(/' \
53 | sed 's/IF_\([A-Z0-9._-]*\)(\(.*\)/\1 \2/' \
55 | while read app name; do
57 test -f "$b" || continue
59 file=`grep -l "bool \"$name[\" ]" $(find -name '*.c') | xargs`
60 # A few applets have their CONFIG items in Config.* files, not .c files:
61 test "$file" || file=`grep -l "bool \"$name[\" ]" $(find -name 'Config.*') | xargs`
62 test "$file" || continue
65 eval "text=\$text_${app}"
68 sz_frac=$(( (sz - sz_kb*1000) ))
69 sz_f=$((sz_frac / 100))
71 echo -n "sed 's/bool \"$name"'[" ](*[0-9tinykbytes .]*)*"*$/'
72 if test "$sz_kb" -ge 10; then
73 echo -n "bool \"$name (${sz_kb} kb)\""
74 elif test "$sz_kb" -gt 0 -a "$sz_f" = 0; then
75 echo -n "bool \"$name (${sz_kb} kb)\""
76 elif test "$sz_kb" -gt 0; then
77 echo -n "bool \"$name ($sz_kb.${sz_f} kb)\""
78 elif test "$sz" -ge 200; then
79 echo -n "bool \"$name ($sz bytes)\""
81 echo -n "bool \"$name (tiny)\""