From f050b1cf7835fd31992b020e1061c52294ff7330 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Wed, 18 Jan 2023 19:19:46 +0100 Subject: depfile: variable with all identifiers (#34678) With the new variable [prefix/]SPACK_PACKAGE_IDS you can conveniently execute things after each successful install. For example push just-built packages to a buildcache ``` SPACK ?= spack export SPACK_COLOR = always MAKEFLAGS += -Orecurse MY_BUILDCACHE := $(CURDIR)/cache .PHONY: all clean all: push ifeq (,$(filter clean,$(MAKECMDGOALS))) include env.mk endif # the relevant part: push has *all* example/push/ as prereqs push: $(addprefix example/push/,$(example/SPACK_PACKAGE_IDS)) $(SPACK) -e . buildcache update-index --directory $(MY_BUILDCACHE) $(info Pushed everything, yay!) # and each example/push/ has the install target as prereq, # and the body can use target local $(HASH) and $(SPEC) variables to do # things, such as pushing to a build cache example/push/%: example/install/% @mkdir -p $(dir $@) $(SPACK) -e . buildcache create --allow-root --only=package --unsigned --directory $(MY_BUILDCACHE) /$(HASH) # push $(SPEC) @touch $@ spack.lock: spack.yaml $(SPACK) -e . concretize -f env.mk: spack.lock $(SPACK) -e . env depfile -o $@ --make-target-prefix example clean: rm -rf spack.lock env.mk example/ `` --- share/spack/templates/depfile/Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'share') diff --git a/share/spack/templates/depfile/Makefile b/share/spack/templates/depfile/Makefile index 4ff7fff0a3..3e844176bc 100644 --- a/share/spack/templates/depfile/Makefile +++ b/share/spack/templates/depfile/Makefile @@ -1,6 +1,9 @@ SPACK ?= spack SPACK_INSTALL_FLAGS ?= +# This variable can be used to add post install hooks +{{ pkg_ids_variable }} := {{ pkg_ids }} + .PHONY: {{ all_target }} {{ clean_target }} {{ all_target }}: {{ env_target }} -- cgit v1.2.3-60-g2f50