aboutsummaryrefslogtreecommitdiff
path: root/guilec.am
diff options
context:
space:
mode:
Diffstat (limited to 'guilec.am')
-rw-r--r--guilec.am48
1 files changed, 48 insertions, 0 deletions
diff --git a/guilec.am b/guilec.am
new file mode 100644
index 0000000..2eb5804
--- /dev/null
+++ b/guilec.am
@@ -0,0 +1,48 @@
+
+# Compilation with Guile-VM's compiler (aka. Guile 2.x).
+
+if HAVE_GUILE2
+
+# XXX: This expression relies on a GNU extension.
+GOBJECTS = $(SOURCES:%.scm=%.go)
+
+nobase_dist_module_DATA = $(SOURCES) $(SOURCES_NOT_COMPILED)
+nobase_nodist_module_DATA = $(GOBJECTS)
+
+# Compiler warnings.
+guile_warnings = \
+ unused-variable unused-toplevel unbound-variable arity-mismatch \
+ format
+
+.scm.go:
+ $(MKDIR_P) `dirname $@`
+ GUILE_AUTO_COMPILE=0 \
+ GUILE_LOAD_COMPILED_PATH="$(builddir):$(top_builddir)/src/guile:$$GUILE_LOAD_COMPILED_PATH" \
+ $(GUILE) -L "$(srcdir)" -L "$(top_srcdir)/src/guile" \
+ -c "(use-modules (system base compile) \
+ (system base message) \
+ (skribilo condition)) \
+ (with-fluids ((*current-warning-prefix* \"\")) \
+ (call-with-skribilo-error-catch/exit \
+ (lambda () \
+ (compile-file \"$<\" #:output-file \"$@\" \
+ #:opts '(#:warnings ($(guile_warnings)))))))"
+
+CLEANFILES += $(GOBJECTS)
+
+SUFFIXES += .go
+
+# Make sure source files are installed first, so that the mtime of
+# installed compiled files is greater than that of installed source
+# files. See
+# <http://lists.gnu.org/archive/html/guile-devel/2010-07/msg00125.html>
+# for details.
+skr_install_go_files = install-nobase_nodist_moduleDATA
+$(skr_install_go_files): install-nobase_dist_moduleDATA
+
+else !HAVE_GUILE2
+
+nobase_dist_module_DATA = $(SOURCES) $(SOURCES_NOT_COMPILED)
+nobase_nodist_module_DATA =
+
+endif !HAVE_GUILE2