summaryrefslogtreecommitdiff
path: root/guilec.am
blob: 8fa3dafddfa939685e3f8059fe79ea549c729fa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 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_guileobject_DATA = $(GOBJECTS)

# Compiler warnings.
guile_warnings =							\
  unused-variable unused-toplevel unbound-variable arity-mismatch	\
  format

AM_V_GUILEC = $(AM_V_GUILEC_$(V))
AM_V_GUILEC_ = $(AM_V_GUILEC_$(AM_DEFAULT_VERBOSITY))
AM_V_GUILEC_0 = @echo "  GUILEC" $@;

# Override $GUILE_LOAD_COMPILED_PATH altogether so we don't end up
# loading .go files from $(moduledir) coming from a previous
# installation (they could be more recent than the local .scm files if
# the user run 'make install' recently.)
.scm.go:
	$(AM_V_GUILEC)$(MKDIR_P) `dirname $@` ;			\
	GUILE_AUTO_COMPILE=0					\
	GUILE_LOAD_COMPILED_PATH="$(builddir):$(top_builddir)/src/guile" \
	$(GUILE) -L "$(srcdir)" -L "$(top_srcdir)/src/guile"	\
	  -L "$(top_builddir)/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_guileobjectDATA
$(skr_install_go_files): install-nobase_dist_moduleDATA

else !HAVE_GUILE2

nobase_dist_module_DATA = $(SOURCES) $(SOURCES_NOT_COMPILED)
nobase_nodist_guileobject_DATA =

endif !HAVE_GUILE2