code: def make_extensions(ctx: Context, compiler, use_cython):
      """Produce a list of Extension instances which passed to cythonize()."""
  
      MODULES = ctx.features.values()
  
      no_cuda = ctx.use_stub
      use_hip = not no_cuda and ctx.use_hip
      settings = build.get_compiler_setting(ctx, use_hip)
  
      include_dirs = settings["include_dirs"]
  
      settings["include_dirs"] = [
          x for x in include_dirs if os.path.exists(x)
      ]
      settings["library_dirs"] = [
          x for x in settings["library_dirs"] if os.path.exists(x)
      ]
  
      # Adjust rpath to use CUDA libraries in `cupy/.data/lib/*.so`) from CuPy.
      use_wheel_libs_rpath = (
          0 < len(ctx.wheel_libs) and not PLATFORM_WIN32
      )
  
      # In the environment with CUDA 7.5 on Ubuntu 16.04, gcc5.3 does not
      # automatically deal with memcpy because string.h header file has
      # been changed. This is a workaround for that environment.
      # See details in the below discussions:
      # https://github.com/BVLC/caffe/issues/4046
      # https://groups.google.com/forum/#!topic/theano-users/3ihQYiTRG4E
      settings["define_macros"].append(("_FORCE_INLINES", "1"))
  
      if ctx.linetrace:
          settings["define_macros"].append(("CYTHON_TRACE", "1"))
          settings["define_macros"].append(("CYTHON_TRACE_NOGIL", "1"))
      if no_cuda:
          settings["define_macros"].append(("CUPY_NO_CUDA", "1"))
      if use_hip:
          settings["define_macros"].append(("CUPY_USE_HIP", "1"))
          # introduced since ROCm 4.2.0
          settings["define_macros"].append(
              ("__HIP_PLATFORM_AMD__", "1")
          )
          # deprecated since ROCm 4.2.0
          settings["define_macros"].append(
              ("__HIP_PLATFORM_HCC__", "1")
          )
      settings["define_macros"].append(
          ("CUPY_CACHE_KEY", ctx.cupy_cache_key)
      )
  
      available_modules = []
      if no_cuda:
          available_modules = [m["name"] for m in MODULES]
      else:
          available_modules, settings = preconfigure_modules(
              ctx, MODULES, compiler, settings
          )
          required_modules = get_required_modules(MODULES)
          if not (set(required_modules) <= set(available_modules)):
              raise Exception(
                  "Your CUDA environment is invalid. "
                  "Please check above error log."
              )
  
      ret = []
      for module in MODULES:
          if module["name"] not in available_modules:
              continue
  
          s = copy.deepcopy(settings)
          if not no_cuda:
              s["libraries"] = module.libraries
              s["extra_objects"] = [
                  _find_static_library(name)
                  for name in module.static_libraries
              ]
  
          compile_args = s.setdefault("extra_compile_args", [])
          link_args = s.setdefault("extra_link_args", [])
  
          if module["name"] == "cusolver":
              # cupy_backends/cupy_lapack.h has C++ template code
              compile_args.append("--std=c++11")
              # openmp is required for cusolver
              if use_hip:
                  pass
              elif compiler.compiler_type == "unix":
                  compile_args.append("-fopenmp")
                  link_args.append("-fopenmp")
              elif compiler.compiler_type == "msvc":
                  compile_args.append("/openmp")
  
          if module["name"] == "random":
              if compiler.compiler_type == "msvc":
                  compile_args.append("-D_USE_MATH_DEFINES")
  
          if module["name"] == "jitify":
              # this fixes RTD (no_cuda) builds...
              compile_args.append("--std=c++11")
              # Uncomment to diagnose Jitify issues.
              # compile_args.append('-DJITIFY_PRINT_ALL')
  
              # if any change is made to the Jitify header, we force recompiling
              s["depends"] = [
                  "./cupy/_core/include/cupy/_jitify/jitify.hpp"
              ]
  
          if module["name"] == "dlpack":
              # if any change is made to the DLPack header, we force recompiling
              s["depends"] = [
                  "./cupy/_core/include/cupy/_dlpack/dlpack.h"
              ]
  
          for f in module["file"]:
              s_file = copy.deepcopy(s)
              name = module_extension_name(f)
  
              if name.endswith("fft._callback") and not PLATFORM_LINUX:
                  continue
  
              rpath = []
              if not ctx.no_rpath:
                  # Add library directories (e.g., `/usr/local/cuda/lib64`) to
                  # RPATH.
                  rpath += s_file["library_dirs"]
  
              if use_wheel_libs_rpath:
                  # Add `cupy/.data/lib` (where shared libraries included in
                  # wheels reside) to RPATH.
                  # The path is resolved relative to the module, e.g., use
                  # `$ORIGIN/../cupy/.data/lib` for `cupy/cudnn.so` and
                  # `$ORIGIN/../../../cupy/.data/lib` for
                  # `cupy_backends/cuda/libs/cudnn.so`.
                  depth = name.count(".")
                  rpath.append(
                      "{}{}/cupy/.data/lib".format(
                          _rpath_base(), "/.." * depth
                      )
                  )
  
              if PLATFORM_LINUX and len(rpath) != 0:
                  ldflag = "-Wl,"
                  if PLATFORM_LINUX:
                      ldflag += "--disable-new-dtags,"
                  ldflag += ",".join("-rpath," + p for p in rpath)
                  args = s_file.setdefault("extra_link_args", [])
                  args.append(ldflag)
  
              sources = module_extension_sources(f, use_cython, no_cuda)
              extension = setuptools.Extension(name, sources, **s_file)
              ret.append(extension)
  
      return ret
  
imports: import copy
  from distutils import ccompiler
  from distutils import sysconfig
  import os
  import shutil
  import sys
  import setuptools
  import cupy_builder.install_build
  from cupy_builder._context import Context
  from cupy_builder.install_build import PLATFORM_LINUX
  from cupy_builder.install_build import PLATFORM_WIN32
label_desc: Use image node_id 10 for calling a global function with example usage: make_extensions(ctx, compiler, use_cython) and returns: ret