def METHOD_NAME(self, spec, prefix):
    # XED needs PYTHONPATH to find the mbuild directory.
    mbuild_dir = join_path(self.stage.source_path, "..", "mbuild")
    python_path = os.getenv("PYTHONPATH", "")
    os.environ["PYTHONPATH"] = mbuild_dir + ":" + python_path
    # In 2023.04.16, the xed source directory must be exactly 'xed',
    # so add a symlink, but don't fail if the link already exists.
    # See: https://github.com/intelxed/xed/issues/300
    try:
        lname = join_path(self.stage.source_path, "..", "xed")
        os.symlink("spack-src", lname)
    except OSError:
        pass
    mfile = Executable(join_path(".", "mfile.py"))
    args = ["-j", str(make_jobs), "--cc=%s" % spack_cc, "--no-werror"]
    if "+debug" in spec:
        args.append("--debug")
    # If an optimization flag (-O...) is specified in CFLAGS, use
    # that, else set default opt level.
    for flag in self.mycflags:
        if flag.startswith("-O"):
            break
    else:
        args.append("--opt=2")
    # Build and install static libxed.a.
    mfile("--clean")
    mfile(*args)
    mkdirp(prefix.include)
    mkdirp(prefix.lib)
    mkdirp(prefix.bin)
    METHOD_NAME(join_path("obj", "lib*.a"), prefix.lib)
    # Build and install shared libxed.so and examples (to get the CLI).
    mfile("--clean")
    mfile("examples", "--shared", *args)
    METHOD_NAME(join_path("obj", "lib*.so"), prefix.lib)
    # Starting with 11.x, the install files are moved or copied into
    # subdirs of obj/wkit.
    if spec.satisfies("@11.0:"):
        wkit = join_path("obj", "wkit")
        METHOD_NAME(join_path(wkit, "bin", "xed"), prefix.bin)
        METHOD_NAME(join_path(wkit, "include", "xed", "*.h"), prefix.include)
    else:
        # Old 2019.03.01 paths.
        METHOD_NAME(join_path("obj", "examples", "xed"), prefix.bin)
        METHOD_NAME(join_path("include", "public", "xed", "*.h"), prefix.include)
        METHOD_NAME(join_path("obj", "*.h"), prefix.include)