-for def in ${LIST}; do
- i=`sed -n 's/^#ifdef \<'$def'\>.*\/\/\(.*$\)/\/\1\//gp' $MF`
- j=`sed -n '/^#ifdef \<'$def'\>.*/,/^#endif/{ s/.*\"\(.*\)\".*/\1/gp; }' $MF`
- for k in $j; do
- echo $i$k
- done
-done
+export LC_ALL=POSIX
+export LC_CTYPE=POSIX
+
+CONFIG_H=${1:-include/autoconf.h}
+APPLETS_H=${2:-include/applets.h}
+$HOSTCC -E -DMAKE_LINKS -include $CONFIG_H $APPLETS_H |
+ awk '/^[ \t]*LINK/{
+ dir=substr($2,7)
+ gsub("_","/",dir)
+ if(dir=="/ROOT") dir=""
+ file=$3
+ gsub("\"","",file)
+ if (file=="busybox") next
+ print tolower(dir) "/" file
+ }'