Skip to content
Snippets Groups Projects

feat: install environment and push to buildcache with Makefile

Merged Wouter Deconinck requested to merge makefile into master
1 file
+ 20
13
Compare changes
  • Side-by-side
  • Inline
+ 20
13
MAKEFLAGS += -Orecurse
SPACK ?= spack
SPACK_INSTALL_FLAGS += --no-check-signature
export SPACK_COLOR = always
SPACK_ENV ?= dev
BUILDCACHE := $(SPACK_ENV)/cache
.PHONY: all clean
all: push
all: $(SPACK_ENV)/push
ifeq (,$(filter clean,$(MAKECMDGOALS)))
include ${SPACK_ENV}/spack.mk
include $(SPACK_ENV)/spack.mk
endif
${SPACK_ENV}/push: $(addprefix ${SPACK_ENV}/push/,$(SPACK_PACKAGE_IDS))
$(SPACK) buildcache update-index --directory $(BUILDCACHE)
$(SPACK_ENV)/push: $(addprefix $(SPACK_ENV)/push/,$($(SPACK_ENV)/SPACK_PACKAGE_IDS))
@mkdir -p $(BUILDCACHE)
$(foreach buildcache, $(BUILDCACHE), $(SPACK) buildcache update-index $(buildcache) ;)
${SPACK_ENV}/push/%: ${SPACK_ENV}/install/%
@mkdir -p $(dir $@)
$(foreach buildcache, $(BUILDCACHE), $(SPACK) buildcache create --allow-root --only=package --unsigned $(buildcache) /$(HASH);)
@touch $@
$(SPACK_ENV)/push/%: $(SPACK_ENV)/install/%
@mkdir -p $(dir $@)
$(foreach buildcache, $(BUILDCACHE), $(SPACK) buildcache create --allow-root --only=package --unsigned $(buildcache) /$(HASH) ;) # push $(SPEC)
@touch $@
${SPACK_ENV}/spack.lock: ${SPACK_ENV}/spack.yaml
$(SPACK) concretize --force
$(SPACK_ENV)/spack.lock: $(SPACK_ENV)/spack.yaml Makefile
$(SPACK) concretize --force --fresh
${SPACK_ENV}/spack.mk: ${SPACK_ENV}/spack.lock
$(SPACK) env depfile --output $@ --make-target-prefix ""
$(SPACK_ENV)/spack.mk: $(SPACK_ENV)/spack.lock Makefile
$(SPACK) env depfile --output $@ --make-prefix $(SPACK_ENV)
clean:
rm -rf ${SPACK_ENV}/spack.lock ${SPACK_ENV}/spack.mk
rm -rf $(SPACK_ENV)/spack.lock $(SPACK_ENV)/spack.mk
Loading