depfile: --make-target-prefix -> --make-prefix (#35009)
Since SPACK_PACKAGE_IDS is now also "namespaced" with <prefix>, it makes more sense to call the flag `--make-prefix` and alias the old flag `--make-target-prefix` to it.
This commit is contained in:
parent
a7613407df
commit
a357a39963
@ -1039,7 +1039,7 @@ gets installed and is available for use in the ``env`` target.
|
||||
$(SPACK) -e . concretize -f
|
||||
|
||||
env.mk: spack.lock
|
||||
$(SPACK) -e . env depfile -o $@ --make-target-prefix spack
|
||||
$(SPACK) -e . env depfile -o $@ --make-prefix spack
|
||||
|
||||
env: spack/env
|
||||
$(info Environment installed!)
|
||||
@ -1062,9 +1062,9 @@ the include is conditional.
|
||||
.. note::
|
||||
|
||||
When including generated ``Makefile``\s, it is important to use
|
||||
the ``--make-target-prefix`` flag and use the non-phony target
|
||||
``<target-prefix>/env`` as prerequisite, instead of the phony target
|
||||
``<target-prefix>/all``.
|
||||
the ``--make-prefix`` flag and use the non-phony target
|
||||
``<prefix>/env`` as prerequisite, instead of the phony target
|
||||
``<prefix>/all``.
|
||||
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Building a subset of the environment
|
||||
@ -1105,7 +1105,7 @@ associated ``Makefile`` with a prefix ``example``:
|
||||
|
||||
.. code:: console
|
||||
|
||||
$ spack env depfile -o env.mk --make-target-prefix example
|
||||
$ spack env depfile -o env.mk --make-prefix example
|
||||
|
||||
And we now include it in a different ``Makefile``, in which we create a target
|
||||
``example/push/%`` with ``%`` referring to a package identifier. This target
|
||||
|
@ -588,12 +588,13 @@ def env_revert(args):
|
||||
def env_depfile_setup_parser(subparser):
|
||||
"""generate a depfile from the concrete environment specs"""
|
||||
subparser.add_argument(
|
||||
"--make-prefix",
|
||||
"--make-target-prefix",
|
||||
default=None,
|
||||
metavar="TARGET",
|
||||
help="prefix Makefile targets with <TARGET>/<name>. By default the absolute "
|
||||
"path to the directory makedeps under the environment metadata dir is "
|
||||
"used. Can be set to an empty string --make-target-prefix ''.",
|
||||
help="prefix Makefile targets (and variables) with <TARGET>/<name>. By default "
|
||||
"the absolute path to the directory makedeps under the environment metadata dir is "
|
||||
"used. Can be set to an empty string --make-prefix ''.",
|
||||
)
|
||||
subparser.add_argument(
|
||||
"--make-disable-jobserver",
|
||||
@ -695,26 +696,26 @@ def env_depfile(args):
|
||||
|
||||
# Special make targets are useful when including a makefile in another, and you
|
||||
# need to "namespace" the targets to avoid conflicts.
|
||||
if args.make_target_prefix is None:
|
||||
target_prefix = os.path.join(env.env_subdir_path, "makedeps")
|
||||
if args.make_prefix is None:
|
||||
prefix = os.path.join(env.env_subdir_path, "makedeps")
|
||||
else:
|
||||
target_prefix = args.make_target_prefix
|
||||
prefix = args.make_prefix
|
||||
|
||||
def get_target(name):
|
||||
# The `all` and `clean` targets are phony. It doesn't make sense to
|
||||
# have /abs/path/to/env/metadir/{all,clean} targets. But it *does* make
|
||||
# sense to have a prefix like `env/all`, `env/clean` when they are
|
||||
# supposed to be included
|
||||
if name in ("all", "clean") and os.path.isabs(target_prefix):
|
||||
if name in ("all", "clean") and os.path.isabs(prefix):
|
||||
return name
|
||||
else:
|
||||
return os.path.join(target_prefix, name)
|
||||
return os.path.join(prefix, name)
|
||||
|
||||
def get_install_target(name):
|
||||
return os.path.join(target_prefix, "install", name)
|
||||
return os.path.join(prefix, "install", name)
|
||||
|
||||
def get_install_deps_target(name):
|
||||
return os.path.join(target_prefix, "install-deps", name)
|
||||
return os.path.join(prefix, "install-deps", name)
|
||||
|
||||
# What things do we build when running make? By default, we build the
|
||||
# root specs. If specific specs are provided as input, we build those.
|
||||
@ -742,10 +743,10 @@ def get_install_deps_target(name):
|
||||
# running tests, etc.
|
||||
# NOTE: GNU Make allows directory separators in variable names, so for consistency
|
||||
# we can namespace this variable with the same prefix as targets.
|
||||
if args.make_target_prefix is None:
|
||||
if args.make_prefix is None:
|
||||
pkg_identifier_variable = "SPACK_PACKAGE_IDS"
|
||||
else:
|
||||
pkg_identifier_variable = os.path.join(target_prefix, "SPACK_PACKAGE_IDS")
|
||||
pkg_identifier_variable = os.path.join(prefix, "SPACK_PACKAGE_IDS")
|
||||
|
||||
# All install and install-deps targets
|
||||
all_install_related_targets = []
|
||||
@ -759,7 +760,7 @@ def get_install_deps_target(name):
|
||||
all_pkg_identifiers.append(tgt)
|
||||
all_install_related_targets.append(get_install_target(tgt))
|
||||
all_install_related_targets.append(get_install_deps_target(tgt))
|
||||
if args.make_target_prefix is None:
|
||||
if args.make_prefix is None:
|
||||
phony_convenience_targets.append(os.path.join("install", tgt))
|
||||
phony_convenience_targets.append(os.path.join("install-deps", tgt))
|
||||
|
||||
@ -782,7 +783,6 @@ def get_install_deps_target(name):
|
||||
"jobserver_support": "+" if args.jobserver else "",
|
||||
"adjacency_list": make_targets.adjacency_list,
|
||||
"phony_convenience_targets": " ".join(phony_convenience_targets),
|
||||
"target_prefix": target_prefix,
|
||||
"pkg_ids_variable": pkg_identifier_variable,
|
||||
"pkg_ids": " ".join(all_pkg_identifiers),
|
||||
}
|
||||
|
@ -3115,7 +3115,7 @@ def test_environment_depfile_makefile(depfile_flags, expected_installs, tmpdir,
|
||||
"-o",
|
||||
makefile,
|
||||
"--make-disable-jobserver",
|
||||
"--make-target-prefix=prefix",
|
||||
"--make-prefix=prefix",
|
||||
*depfile_flags,
|
||||
)
|
||||
|
||||
@ -3164,7 +3164,7 @@ def test_spack_package_ids_variable(tmpdir, mock_packages):
|
||||
"-G",
|
||||
"make",
|
||||
"--make-disable-jobserver",
|
||||
"--make-target-prefix=example",
|
||||
"--make-prefix=example",
|
||||
"-o",
|
||||
include_path,
|
||||
)
|
||||
|
@ -1004,7 +1004,7 @@ _spack_env_revert() {
|
||||
_spack_env_depfile() {
|
||||
if $list_options
|
||||
then
|
||||
SPACK_COMPREPLY="-h --help --make-target-prefix --make-disable-jobserver --use-buildcache -o --output -G --generator"
|
||||
SPACK_COMPREPLY="-h --help --make-prefix --make-target-prefix --make-disable-jobserver --use-buildcache -o --output -G --generator"
|
||||
else
|
||||
_all_packages
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user