summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2022-11-15 18:03:17 +0100
committerGitHub <noreply@github.com>2022-11-15 18:03:17 +0100
commitaf74680405c931dab16c6674f9b97a32bf3f1122 (patch)
tree0c6081df5241a6db996f228ff7cf9aaa40d71f99 /share
parentd1715c5fdf6eaf21e79e3046f331374e21100503 (diff)
downloadspack-af74680405c931dab16c6674f9b97a32bf3f1122.tar.gz
spack-af74680405c931dab16c6674f9b97a32bf3f1122.tar.bz2
spack-af74680405c931dab16c6674f9b97a32bf3f1122.tar.xz
spack-af74680405c931dab16c6674f9b97a32bf3f1122.zip
depfile: improve tab completion (#33773)
This PR allows you to do: ``` spack env create -d . spack -e . add python spack -e . concretize spack -e . env depfile -o Makefile make in<tab> # -> install make install-<tab> # -> install-deps/ make install-deps/py<tab> # -> install-deps/python-x.y.z-hash make install/zl<tab> # -> install/zlib-x.y.z-hash make SP<tab> # -> make SPACK make SPACK_<tab> # -> make SPACK_INSTALL_FLAGS= ```
Diffstat (limited to 'share')
-rw-r--r--share/spack/templates/depfile/Makefile23
1 files changed, 17 insertions, 6 deletions
diff --git a/share/spack/templates/depfile/Makefile b/share/spack/templates/depfile/Makefile
index dc0aeb79ea..4ff7fff0a3 100644
--- a/share/spack/templates/depfile/Makefile
+++ b/share/spack/templates/depfile/Makefile
@@ -1,4 +1,5 @@
SPACK ?= spack
+SPACK_INSTALL_FLAGS ?=
.PHONY: {{ all_target }} {{ clean_target }}
@@ -10,27 +11,37 @@ SPACK ?= spack
{{ dirs_target }}:
@mkdir -p {{ install_target }} {{ install_deps_target }}
+{% if phony_convenience_targets %}
+.PHONY: {{ phony_convenience_targets }}
+{% endif %}
+
# The spack install commands are of the form:
# spack -e my_env --no-add --only=package --only=concrete /hash
# This is an involved way of expressing that Spack should only install
# an individual concrete spec from the environment without deps.
-{{ install_target }}/%: {{ install_deps_target }}/% | {{ dirs_target }}
- {{ jobserver_support }}$(SPACK) -e '{{ environment }}' install $(SPACK_BUILDCACHE_FLAG) $(SPACK_INSTALL_FLAGS) --only-concrete --only=package --no-add /$(notdir $@) # $(SPEC)
+{{ install_target }}/%: | {{ dirs_target }}
+ {{ jobserver_support }}$(SPACK) -e '{{ environment }}' install $(SPACK_BUILDCACHE_FLAG) $(SPACK_INSTALL_FLAGS) --only-concrete --only=package --no-add /$(HASH) # $(SPEC)
@touch $@
{{ install_deps_target }}/%: | {{ dirs_target }}
@touch $@
# Set a human-readable SPEC variable for each target that has a hash
-{% for (parent, name, build_cache, _) in adjacency_list -%}
+{% for (parent, _, hash, name, build_cache) in adjacency_list -%}
+{{ any_hash_target }}/{{ parent }}: HASH = {{ hash }}
{{ any_hash_target }}/{{ parent }}: SPEC = {{ name }}
{{ any_hash_target }}/{{ parent }}: SPACK_BUILDCACHE_FLAG = {{ build_cache }}
{% endfor %}
# The Spack DAG expressed in targets:
-{% for (parent, _, _, prereqs) in adjacency_list -%}
-{{ install_deps_target }}/{{ parent }}: {{prereqs}}
+{% for (parent, prereqs, _, _, _) in adjacency_list -%}
+{{ install_target }}/{{ parent }}: {{ install_deps_target }}/{{ parent }}
+{{ install_deps_target }}/{{ parent }}: {{ prereqs }}
+{% if phony_convenience_targets %}
+install/{{ parent }}: {{ install_target }}/{{ parent }}
+install-deps/{{ parent }}: {{ install_deps_target }}/{{ parent }}
+{% endif %}
{% endfor %}
{{ clean_target }}:
- rm -rf {{ env_target }} {{ cleanable_targets }}
+ rm -rf {{ env_target }} {{ all_install_related_targets }}