From 1f6cffb66384701df4d3897611dbfebf48a62c6c Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Mon, 3 Apr 2023 20:17:07 -0500
Subject: [PATCH] fix: makefile fixes

---
 spack-environment/Makefile | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/spack-environment/Makefile b/spack-environment/Makefile
index 983b5e73d..713dbef0e 100644
--- a/spack-environment/Makefile
+++ b/spack-environment/Makefile
@@ -1,29 +1,36 @@
+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
-- 
GitLab