3 # Clear out the build directory. (Make clean should do this instead of here.)
8 # Make our prerequisites.
10 make busybox.links include/bb_config.h
12 # Adding "libbb/libbb.a" to the previous line doesn't work, nor does going
13 # "make libbb.a" in the libb directory. The busybox makefile has layers and
14 # layers of overcomplicated brokenness...
22 cd archival/libunarchive
26 # About 3/5 of the applets build from one .c file (with the same name as the
27 # corresponding applet), and all it needs to link against. However, to build
28 # them all we need more than that.
30 # Figure out which applets need extra libraries added to their command line.
32 function extra_libraries()
34 archival="ar bunzip2 unlzma cpio dpkg gunzip rpm2cpio rpm tar uncompress unzip dpkg_deb gzip "
35 if [ "${archival/$1 //}" != "${archival}" ]
37 echo "archival/libunarchive/libunarchive.a"
43 if [ "${libm/$1 //}" != "${libm}" ]
49 # Query applets.h to figure out which need something funky
51 strange_names=`sed -rn -e 's/\#.*//' -e 's/.*APPLET_NOUSAGE\(([^,]*),([^,]*),.*/\1 \2/p' -e 's/.*APPLET_ODDNAME\(([^,]*),([^,]*),.*, *([^)]*).*/\1 \2@\3/p' include/applets.h`
57 if [ "$APPLET" == "$1" ]
60 if [ "${APPFILT}" == "$2" ]
62 HELPNAME='"nousage\n"'
64 HELPNAME="${2/*@/}"_full_usage
70 #echo APPLET=${APPLET} APPFILT=${APPFILT} HELPNAME=${HELPNAME} 2=${2}
73 for APPLET in `sed 's .*/ ' busybox.links`
76 export APPFILT=${APPLET}
77 export HELPNAME=${APPLET}_full_usage
78 bonkname $strange_names
80 j=`find . -name "${APPFILT}.c"`
83 echo no file for $APPLET
85 echo "Building $APPLET"
86 gcc -Os -o build/$APPLET applets/individual.c $j \
87 `extra_libraries $APPFILT` libbb/libbb.a -Iinclude \
89 "-Drun_applet_by_name(...)" "-Dfind_applet_by_name(...) 0" \
90 -DAPPLET_main=${APPFILT}_main -DAPPLET_full_usage=${HELPNAME}