bc: convert to "G trick" - this returns bc to zero bss increase
[oweals/busybox.git] / scripts / embedded_scripts
index b7a023ce04e537916c30c0ff094b526da1b62cfb..aa7bf3e8a1924d7ecc85d6228bdfb1e2d0b2ec4e 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+. ./.config || exit 1
+
 target="$1"
 custom_loc="$2"
 applet_loc="$3"
@@ -8,6 +10,12 @@ test "$target" || exit 1
 test "$SED" || SED=sed
 test "$DD" || DD=dd
 
+if [ x"$CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS" != x"y" ]
+then
+       printf '#define NUM_SCRIPTS 0\n' >"$target"
+       exit 0
+fi
+
 # Some people were bitten by their system lacking a (proper) od
 od -v -b </dev/null >/dev/null
 if test $? != 0; then
@@ -20,7 +28,7 @@ if [ -d "$custom_loc" ]
 then
        custom_scripts=$(cd $custom_loc; ls * 2>/dev/null)
 fi
-all_scripts=$(applets/busybox.mkscripts)
+all_scripts=$($srctree/applets/busybox.mkscripts)
 
 # all_scripts includes applet scripts and custom scripts, sort them out
 applet_scripts=""
@@ -81,21 +89,15 @@ exec >"$target.$$"
 if [ $n -ne 0 ]
 then
        printf '#ifdef DEFINE_SCRIPT_DATA\n'
-       if [ $n -ne 0 ]
-       then
-               printf 'const uint16_t applet_numbers[] = {\n'
-               for i in $custom_scripts $applet_scripts
-               do
-                       # TODO support applets with names including invalid characters
-                       printf '\tAPPLET_NO_%s,\n' $i
-               done
-               printf '};\n'
-       fi
+       printf 'const uint16_t applet_numbers[] = {\n'
+       for i in $custom_scripts $applet_scripts
+       do
+               # TODO support applets with names including invalid characters
+               printf '\tAPPLET_NO_%s,\n' $i
+       done
+       printf '};\n'
        printf '#else\n'
-       if [ $n -ne 0 ]
-       then
-               printf 'extern const uint16_t applet_numbers[];\n'
-       fi
+       printf 'extern const uint16_t applet_numbers[];\n'
        printf '#endif\n'
 fi