Address comments
diff --git a/build_tools/cmake/iree_cross_compile.cmake b/build_tools/cmake/iree_cross_compile.cmake
index 8691ff4..8538177 100644
--- a/build_tools/cmake/iree_cross_compile.cmake
+++ b/build_tools/cmake/iree_cross_compile.cmake
@@ -12,22 +12,28 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# iree_to_bool
-#
-# Sets `variable` to `ON` if `value` is true and `OFF` otherwise.
-function(iree_to_bool variable value)
-  if(value)
-    set(${variable} "ON" PARENT_SCOPE)
-  else()
-    set(${variable} "OFF" PARENT_SCOPE)
-  endif()
-endfunction()
+include(iree_macros)
 
 # iree_create_configuration
 #
-# Creates custom commands and targets for an IREE configuration.
+# Creates custom commands and targets for an IREE configuration. An IREE
+# configuration means a new IREE CMake invocation with its own set of
+# parameters.
 #
-# Environment variables:
+# This function defines two custom target, `iree_prepare_${config_name}_dir`
+# and `iree_configure_${config_name}`, to drive the creation of a directory
+# for hosting the new IREE configuration and its corresponding `CMakeCache.txt`
+# file, respectively. Callers can then depend on either the file or the
+# target to make sure the configuration is invoked as a dependency.
+#
+# This function is typically useful when cross-compiling towards another
+# architecture. For example, when cross-compiling towards Android, we need
+# to have certain tools first compiled on the host so that we can use them
+# to programmatically generate some source code to be compiled together
+# with other checked-in source code. Those host tools will be generated
+# by another CMake invocation configured by this function.
+#
+# Supported CMake options:
 # - IREE_<config_name>_BINARY_ROOT: the root directory for containing IREE build
 #   artifacts for the given `config_name`. If not specified in caller, this is
 #   set to a directory named as `config_name` under the current CMake binary
@@ -47,72 +53,72 @@
     message(STATUS "Setting ${config_name} build directory to ${IREE_${config_name}_BINARY_ROOT}")
   endif()
 
-  set(config_binary_root ${IREE_${config_name}_BINARY_ROOT})
+  set(_CONFIG_BINARY_ROOT ${IREE_${config_name}_BINARY_ROOT})
 
-  set(config_c_compiler ${IREE_${config_name}_C_COMPILER})
-  set(config_cxx_compiler ${IREE_${config_name}_CXX_COMPILER})
+  set(_CONFIG_C_COMPILER ${IREE_${config_name}_C_COMPILER})
+  set(_CONFIG_CXX_COMPILER ${IREE_${config_name}_CXX_COMPILER})
 
   # Check the compilers are specified in the caller.
-  if("${config_c_compiler}" STREQUAL "")
-    message(FATAL_ERROR "Must define IREE_${config_name}_C_COMPILER for ${config_name} build")
+  if("${_CONFIG_C_COMPILER}" STREQUAL "")
+    message(FATAL_ERROR "Must define IREE_${config_name}_C_COMPILER for \"${config_name}\" configuration build")
   endif()
-  if("${config_cxx_compiler}" STREQUAL "")
-    message(FATAL_ERROR "Must define IREE_${config_name}_CXX_COMPILER for ${config_name} build")
+  if("${_CONFIG_CXX_COMPILER}" STREQUAL "")
+    message(FATAL_ERROR "Must define IREE_${config_name}_CXX_COMPILER for \"${config_name}\" configuration build")
   endif()
 
-  add_custom_command(OUTPUT ${config_binary_root}
-    COMMAND ${CMAKE_COMMAND} -E make_directory ${config_binary_root}
-    COMMENT "Creating ${config_binary_root}...")
+  add_custom_command(OUTPUT ${_CONFIG_BINARY_ROOT}
+    COMMAND ${CMAKE_COMMAND} -E make_directory ${_CONFIG_BINARY_ROOT}
+    COMMENT "Creating ${_CONFIG_BINARY_ROOT}...")
 
   # Give it a custom target so we can drive the generation manually
   # when useful.
-  add_custom_target(iree_prepare_${config_name}_dir DEPENDS ${config_binary_root})
+  add_custom_target(iree_prepare_${config_name}_dir DEPENDS ${_CONFIG_BINARY_ROOT})
 
   # LINT.IfChange(iree_cross_compile_options)
-  iree_to_bool(config_enable_runtime_tracing "${IREE_${config_name}_ENABLE_RUNTIME_TRACING}")
-  iree_to_bool(config_enable_llvm "${IREE_${config_name}_ENABLE_LLVM}")
-  iree_to_bool(config_enable_emitc "${IREE_${config_name}_ENABLE_EMITC}")
+  iree_to_bool(_CONFIG_ENABLE_RUNTIME_TRACING "${IREE_${config_name}_ENABLE_RUNTIME_TRACING}")
+  iree_to_bool(_CONFIG_ENABLE_LLVM "${IREE_${config_name}_ENABLE_LLVM}")
+  iree_to_bool(_CONFIG_ENABLE_EMITC "${IREE_${config_name}_ENABLE_EMITC}")
 
-  iree_to_bool(config_build_compiler "${IREE_${config_name}_BUILD_COMPILER}")
-  iree_to_bool(config_build_tests "${IREE_${config_name}_BUILD_TESTS}")
-  iree_to_bool(config_build_docs "${IREE_${config_name}_BUILD_DOCS}")
-  iree_to_bool(config_build_samples "${IREE_${config_name}_BUILD_SAMPLES}")
-  iree_to_bool(config_build_debugger "${IREE_${config_name}_BUILD_DEBUGGER}")
-  iree_to_bool(config_build_python_bindings "${IREE_${config_name}_BUILD_PYTHON_BINDINGS}")
-  iree_to_bool(config_build_experimental "${IREE_${config_name}_BUILD_EXPERIMENTAL}")
+  iree_to_bool(_CONFIG_BUILD_COMPILER "${IREE_${config_name}_BUILD_COMPILER}")
+  iree_to_bool(_CONFIG_BUILD_TESTS "${IREE_${config_name}_BUILD_TESTS}")
+  iree_to_bool(_CONFIG_BUILD_DOCS "${IREE_${config_name}_BUILD_DOCS}")
+  iree_to_bool(_CONFIG_BUILD_SAMPLES "${IREE_${config_name}_BUILD_SAMPLES}")
+  iree_to_bool(_CONFIG_BUILD_DEBUGGER "${IREE_${config_name}_BUILD_DEBUGGER}")
+  iree_to_bool(_CONFIG_BUILD_PYTHON_BINDINGS "${IREE_${config_name}_BUILD_PYTHON_BINDINGS}")
+  iree_to_bool(_CONFIG_BUILD_EXPERIMENTAL "${IREE_${config_name}_BUILD_EXPERIMENTAL}")
 
   # Escape semicolons in the targets list so that CMake doesn't expand them to
   # spaces.
-  string(REPLACE ";" "$<SEMICOLON>" config_hal_drivers_to_build "${IREE_HAL_DRIVERS_TO_BUILD}")
-  string(REPLACE ";" "$<SEMICOLON>" config_compiler_targets_to_build "${IREE_TARGET_BACKENDS_TO_BUILD}")
+  string(REPLACE ";" "$<SEMICOLON>" _CONFIG_HAL_DRIVERS_TO_BUILD "${IREE_HAL_DRIVERS_TO_BUILD}")
+  string(REPLACE ";" "$<SEMICOLON>" _CONFIG_TARGET_BACKENDS_TO_BUILD "${IREE_TARGET_BACKENDS_TO_BUILD}")
   # LINT.ThenChange(https://github.com/google/iree/tree/master/CMakeLists.txt:iree_options)
 
-  message(STATUS "C compiler for ${config_name} build: ${config_c_compiler}")
-  message(STATUS "C++ compiler for ${config_name} build: ${config_cxx_compiler}")
+  message(STATUS "C compiler for ${config_name} build: ${_CONFIG_C_COMPILER}")
+  message(STATUS "C++ compiler for ${config_name} build: ${_CONFIG_CXX_COMPILER}")
 
   add_custom_command(OUTPUT ${IREE_${config_name}_BINARY_ROOT}/CMakeCache.txt
     COMMAND "${CMAKE_COMMAND}" "${PROJECT_SOURCE_DIR}" -G "${CMAKE_GENERATOR}"
         -DCMAKE_MAKE_PROGRAM="${CMAKE_MAKE_PROGRAM}"
         -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
-        -DCMAKE_C_COMPILER="${config_c_compiler}"
-        -DCMAKE_CXX_COMPILER="${config_cxx_compiler}"
-        -DIREE_ENABLE_RUNTIME_TRACING=${config_enable_runtime_tracing}
-        -DIREE_ENABLE_LLVM=${config_enable_llvm}
-        -DIREE_ENABLE_EMITC=${config_enable_emitc}
-        -DIREE_BUILD_COMPILER=${config_build_compiler}
-        -DIREE_BUILD_TESTS=${config_build_tests}
-        -DIREE_BUILD_DOCS=${config_build_docs}
-        -DIREE_BUILD_SAMPLES=${config_build_samples}
-        -DIREE_BUILD_DEBUGGER=${config_build_debugger}
-        -DIREE_BUILD_PYTHON_BINDINGS=${config_build_python_bindings}
-        -DIREE_BUILD_EXPERIMENTAL=${config_build_experimental}
-        -DIREE_HAL_DRIVERS_TO_BUILD="${config_hal_drivers_to_build}"
-        -DIREE_TARGET_BACKENDS_TO_BUILD="${config_compiler_targets_to_build}"
-    WORKING_DIRECTORY ${config_binary_root}
+        -DCMAKE_C_COMPILER="${_CONFIG_C_COMPILER}"
+        -DCMAKE_CXX_COMPILER="${_CONFIG_CXX_COMPILER}"
+        -DIREE_ENABLE_RUNTIME_TRACING=${_CONFIG_ENABLE_RUNTIME_TRACING}
+        -DIREE_ENABLE_LLVM=${_CONFIG_ENABLE_LLVM}
+        -DIREE_ENABLE_EMITC=${_CONFIG_ENABLE_EMITC}
+        -DIREE_BUILD_COMPILER=${_CONFIG_BUILD_COMPILER}
+        -DIREE_BUILD_TESTS=${_CONFIG_BUILD_TESTS}
+        -DIREE_BUILD_DOCS=${_CONFIG_BUILD_DOCS}
+        -DIREE_BUILD_SAMPLES=${_CONFIG_BUILD_SAMPLES}
+        -DIREE_BUILD_DEBUGGER=${_CONFIG_BUILD_DEBUGGER}
+        -DIREE_BUILD_PYTHON_BINDINGS=${_CONFIG_BUILD_PYTHON_BINDINGS}
+        -DIREE_BUILD_EXPERIMENTAL=${_CONFIG_BUILD_EXPERIMENTAL}
+        -DIREE_HAL_DRIVERS_TO_BUILD="${_CONFIG_HAL_DRIVERS_TO_BUILD}"
+        -DIREE_TARGET_BACKENDS_TO_BUILD="${_CONFIG_TARGET_BACKENDS_TO_BUILD}"
+    WORKING_DIRECTORY ${_CONFIG_BINARY_ROOT}
     DEPENDS iree_prepare_${config_name}_dir
     COMMENT "Configuring IREE for ${config_name} build...")
 
-  add_custom_target(iree_configure_${config_name} DEPENDS ${config_binary_root}/CMakeCache.txt)
+  add_custom_target(iree_configure_${config_name} DEPENDS ${_CONFIG_BINARY_ROOT}/CMakeCache.txt)
 endfunction()
 
 # iree_get_build_command
diff --git a/build_tools/cmake/iree_macros.cmake b/build_tools/cmake/iree_macros.cmake
index 10e7ce4..dddbc6c 100644
--- a/build_tools/cmake/iree_macros.cmake
+++ b/build_tools/cmake/iree_macros.cmake
@@ -25,6 +25,22 @@
 endif()
 
 #-------------------------------------------------------------------------------
+# General utilities
+#-------------------------------------------------------------------------------
+
+# iree_to_bool
+#
+# Sets `variable` to `ON` if `value` is true and `OFF` otherwise.
+function(iree_to_bool variable value)
+  if(value)
+    set(${variable} "ON" PARENT_SCOPE)
+  else()
+    set(${variable} "OFF" PARENT_SCOPE)
+  endif()
+endfunction()
+
+
+#-------------------------------------------------------------------------------
 # Packages and Paths
 #-------------------------------------------------------------------------------