aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-03-04 01:50:46 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-03-06 11:37:32 +0100
commit1cc4d947524b4780f0055e62e152083982bbf186 (patch)
tree31f4667b8a0eb7a77563df1fe98460a5d6774613 /Makefile
parentTests now use our local compiled files. (diff)
downloadcalp-1cc4d947524b4780f0055e62e152083982bbf186.tar.gz
calp-1cc4d947524b4780f0055e62e152083982bbf186.tar.xz
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.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 18 insertions, 9 deletions
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)