-cd ${2:-.}
-# I added in the extra "ls" so only source files that
-# actually exist will show up in the compile list.
-ls -1 $RAW 2>/dev/null | sed -e 's/\.c$/\.o/g'
+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' ' '