diff --git a/bootstrap b/bootstrap
index e90c8893800a3bc3c5604dfd4675f405168a3d1b..426d804d4e9d64289e8cdb7c2771dac88a1a219f 100755
--- a/bootstrap
+++ b/bootstrap
@@ -878,8 +878,9 @@ for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_
 done
 
 # Generate dependencies for cmBootstrapCommands.cxx
-cmBootstrapCommandsDepsDir=`cmake_escape "${cmake_source_dir}/Source/"`
-cmBootstrapCommandsDeps=`grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands.cxx" | sed "s/.* \"\(.*\)\"/\1/" | awk "{ print \"${cmBootstrapCommandsDepsDir}\" \\$1}"`
+for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
+  cmBootstrapCommandsDeps="${cmBootstrapCommandsDeps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
+done
 cmBootstrapCommandsDeps=`echo $cmBootstrapCommandsDeps`
 
 if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then