summaryrefslogtreecommitdiff
path: root/make_single_applets.sh (plain)
blob: 5b9393e33dcfaa42091e586e2e403b6fb07668b5
1#!/bin/sh
2# This script expects that the tree was built with the desired .config:
3# in particular, it expects that include/applets.h is generated already.
4#
5# The script will try to rebuild each enabled applet in isolation.
6# All other options which chose general bbox config, applet features, etc,
7# are not modified for the builds.
8
9makeopts="-j9"
10
11# The list of all applet config symbols
12test -f include/applets.h || { echo "No include/applets.h file"; exit 1; }
13apps="`
14grep ^IF_ include/applets.h \
15| grep -v ^IF_FEATURE_ \
16| sed 's/IF_\([A-Z0-9._-]*\)(.*/\1/' \
17| grep -v ^MODPROBE_SMALL \
18| sort | uniq
19`"
20
21# Take existing config
22test -f .config || { echo "No .config file"; exit 1; }
23cfg="`cat .config`"
24
25# Make a config with all applet symbols off
26allno="$cfg"
27for app in $apps; do
28 allno="`echo "$allno" | sed "s/^CONFIG_${app}=y\$/# CONFIG_${app} is not set/"`"
29done
30
31# Turn on each applet individually and build single-applet executable
32fail=0
33for app in $apps; do
34 # Only if it was indeed originally enabled...
35 { echo "$cfg" | grep -q "^CONFIG_${app}=y\$"; } || continue
36
37 echo "Making ${app}..."
38 mv .config .config.SV
39 echo "CONFIG_${app}=y" >.config
40 echo "$allno" | sed "/^# CONFIG_${app} is not set\$/d" >>.config
41 if ! yes '' | make oldconfig >busybox_make_${app}.log 2>&1; then
42 : $((fail++))
43 echo "Config error for ${app}"
44 mv .config busybox_config_${app}
45 elif ! make $makeopts >busybox_make_${app}.log 2>&1; then
46 : $((fail++))
47 echo "Build error for ${app}"
48 mv .config busybox_config_${app}
49 else
50 mv busybox busybox_${app}
51 rm busybox_make_${app}.log
52 fi
53 mv .config.SV .config
54 #exit
55done
56echo "Failures: $fail"
57test $fail = 0 # set exitcode
58