From 440ac2c66deba0a42ecf6ddc670f09bdac83bb50 Mon Sep 17 00:00:00 2001 From: Alasdair Date: Fri, 15 Dec 2023 17:01:20 +0000 Subject: [PATCH] Makefile: Make sure OPAMCLI is 2.0 in all subshells Furthermore, make sure variables defined by calling opam are created using :=, so opam is not called each time they are expanded --- Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 32073dd84..8004a56f5 100644 --- a/Makefile +++ b/Makefile @@ -138,14 +138,16 @@ export SAIL_DIR EXPLICIT_COQ_SAIL=yes else # Use sail from opam package -SAIL_DIR:=$(shell opam config var sail:share) +SAIL_DIR:=$(shell OPAMCLI=$(OPAMCLI) opam config var sail:share) SAIL:=sail endif SAIL_LIB_DIR:=$(SAIL_DIR)/lib export SAIL_LIB_DIR SAIL_SRC_DIR:=$(SAIL_DIR)/src -LEM_DIR?=$(shell opam config var lem:share) +ifndef LEM_DIR +LEM_DIR:=$(shell OPAMCLI=$(OPAMCLI) opam config var lem:share) +endif export LEM_DIR C_WARNINGS ?= @@ -370,9 +372,9 @@ riscv_hol_build: generated_definitions/hol4/$(ARCH)/riscvTheory.uo .PHONY: riscv_hol riscv_hol_build ifdef BBV_DIR - EXPLICIT_COQ_BBV = yes + EXPLICIT_COQ_BBV := yes else - EXPLICIT_COQ_BBV = $(shell if opam config var coq-bbv:share >/dev/null 2>/dev/null; then echo no; else echo yes; fi) + EXPLICIT_COQ_BBV := $(shell if OPAMCLI=$(OPAMCLI) opam config var coq-bbv:share >/dev/null 2>/dev/null; then echo no; else echo yes; fi) ifeq ($(EXPLICIT_COQ_BBV),yes) #Coq BBV library hopefully checked out in directory above us BBV_DIR = ../bbv @@ -380,7 +382,7 @@ else endif ifndef EXPLICIT_COQ_SAIL - EXPLICIT_COQ_SAIL = $(shell if opam config var coq-sail:share >/dev/null 2>/dev/null; then echo no; else echo yes; fi) + EXPLICIT_COQ_SAIL := $(shell if OPAMCLI=$(OPAMCLI) opam config var coq-sail:share >/dev/null 2>/dev/null; then echo no; else echo yes; fi) endif COQ_LIBS = -R generated_definitions/coq Riscv -R generated_definitions/coq/$(ARCH) $(ARCH) -R handwritten_support Riscv_common