From 1cc4d947524b4780f0055e62e152083982bbf186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 4 Mar 2022 01:50:46 +0100 Subject: Allow explicit GUILE environment, document it. The environment variable GUILE can now be set to override the guile version, which allows us to test the code with multiple versions/implementations. Also updates README to note these variables. --- Makefile | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 5144c888..93dd6b6c 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,19 @@ .PHONY: all clean test \ - static coverage + static coverage \ + go_files -GUILE_SITE_DIR=$(shell guile -c "(display (%site-dir))") -GUILE_CCACHE_DIR=$(shell guile -c "(display (%site-ccache-dir))") +GUILE := guile +export GUILE + +GUILD := guild + +GUILE_VERSION=$(shell $(GUILE) -c '(display (version))') + +GUILE_SITE_DIR=$(shell $(GUILE) -c "(display (%site-dir))") +GUILE_CCACHE_DIR=$(shell $(GUILE) -c "(display (%site-ccache-dir))") SCM_FILES = $(shell find module/ -type f -name \*.scm) -GO_FILES = $(SCM_FILES:module/%.scm=obj/%.go) +GO_FILES = $(SCM_FILES:module/%.scm=obj-$(GUILE_VERSION)/%.go) GUILE_C_FLAGS = -Lmodule \ -Wunused-toplevel \ @@ -18,16 +26,17 @@ all: go_files README static static: $(MAKE) -C static -obj/%.go: module/%.scm - @mkdir -p obj - @echo guild compile $< - @guild compile $(GUILE_C_FLAGS) -o $@ $< +obj-$(GUILE_VERSION)/%.go: module/%.scm + @echo $(GUILD) compile $< + @$(GUILD) compile $(GUILE_C_FLAGS) -o $@ $< +# Phony target used by test/run-tests.scm and main to +# automatically compile everything before they run. go_files: $(GO_FILES) clean: -$(MAKE) -C static clean - -rm -r obj + -rm -r obj-* install: all install -d $(DESTDIR)$(GUILE_SITE_DIR) $(DESTDIR)$(GUILE_CCACHE_DIR) -- cgit v1.2.3