#!/bin/sh

# $Progeny: busybox.sh,v 1.3 2002/01/18 06:19:49 dsp Exp $
# Grrr, this is part of busybox but it is not extensible.  I need the
# Config.h pre-processed differently for the live and initrd builds,
# so make this script pass the rest of its arguments along to the
# pre-processor.

export LC_ALL=POSIX
export LC_CTYPE=POSIX

config=$1
shift

RAW=` \
    gcc -E -dM $@ ${config} | \
    sed -n -e '/^.*BB_FEATURE.*$/d;s/^#define.*\<BB_\(.*\)\>/\1.c/gp;' \
    | tr A-Z a-z | sort
`
test "${RAW}" != "" ||  exit
if [ -d "$BB_SRC_DIR" ]; then cd $BB_SRC_DIR; fi
# By running $RAW through "ls", we avoid listing
# source files that don't exist.
ls $RAW 2>/dev/null | tr '\n' ' '

