summaryrefslogtreecommitdiff
path: root/guile/src/Makefile.am
blob: 28c924f55681a640fed626fc50632bf5df7cf85c (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#  GnuTLS --- Guile bindings for GnuTLS.
#  Copyright (C) 2007-2013 Free Software Foundation, Inc.
#
#  GnuTLS is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation; either
#  version 2.1 of the License, or (at your option) any later version.
#
#  GnuTLS is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public
#  License along with GnuTLS; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

GUILE_FOR_BUILD =						\
  GUILE_AUTO_COMPILE=0 $(GUILE) -L $(top_srcdir)/guile/modules

noinst_HEADERS = errors.h utils.h

EXTRA_DIST =					\
  make-enum-map.scm make-smob-types.scm		\
  make-enum-header.scm make-smob-header.scm	\
  make-session-priorities.scm

# Files generated by the (gnutls build ...) modules.
GENERATED_BINDINGS =				\
  enum-map.i.c smob-types.i.c enums.h smobs.h	\
  priorities.i.c

BUILT_SOURCES =					\
  $(GENERATED_BINDINGS)				\
  core.x errors.x

CLEANFILES = $(BUILT_SOURCES)

guileextension_LTLIBRARIES  = guile-gnutls-v-2.la
guile_gnutls_v_2_la_LDFLAGS = -module

# Linking against GnuTLS.
GNUTLS_CORE_LIBS  = $(top_builddir)/lib/libgnutls.la

# Linking against Gnulib modules.
GNULIB_LIBS    = $(top_builddir)/gl/libgnu.la
GNULIB_CFLAGS  = -I$(top_builddir)/gl -I$(top_srcdir)/gl


guile_gnutls_v_2_la_SOURCES = core.c errors.c utils.c
guile_gnutls_v_2_la_CFLAGS =			\
  $(AM_CFLAGS) $(GNULIB_CFLAGS) $(GUILE_CFLAGS)
guile_gnutls_v_2_la_LIBADD = \
	$(GNUTLS_CORE_LIBS) $(GNULIB_LIBS) \
	$(GUILE_LDFLAGS)

AM_CPPFLAGS = \
	-I$(top_srcdir)/lib/includes \
	-I$(top_builddir)/lib/includes	\
	-I$(top_srcdir)/extra/includes \
	-I$(top_builddir) \
	-I$(builddir)

if HAVE_GCC

# Generated `.x' files and Guile's `scm_c_define_gsubr ()' require
# `-Wno-strict-prototypes'.  This trick makes sure `-Wno-s-p' appears
# after `-Ws-p'.
AM_CFLAGS = -Wno-strict-prototypes

# The `-fgnu89-inline' option appeared in GCC 4.1.3.
if HAVE_GCC_GNU89_INLINE_OPTION

# Guile and GMP currently rely on GNU inline semantics, not C99 inline.
AM_CFLAGS += -fgnu89-inline

endif HAVE_GCC_GNU89_INLINE_OPTION

endif HAVE_GCC


enums.h: $(srcdir)/make-enum-header.scm
	$(GUILE_FOR_BUILD) $^ > $@

enum-map.i.c: $(srcdir)/make-enum-map.scm
	$(GUILE_FOR_BUILD) $^ > $@

smobs.h: $(srcdir)/make-smob-header.scm
	$(GUILE_FOR_BUILD) $^ > $@

smob-types.i.c: $(srcdir)/make-smob-types.scm
	$(GUILE_FOR_BUILD) $^ > $@

priorities.i.c: $(srcdir)/make-session-priorities.scm
	$(GUILE_FOR_BUILD) $^ > $@


# C file snarfing.

# `$(GUILE_CFLAGS)' may contain a series of `-I' switches so it must be
# included here, even though we'd really want `$(GUILE_CPPFLAGS)'.
snarfcppopts = $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
	       $(CFLAGS) $(guile_gnutls_v_2_la_CFLAGS)

# Note: we cannot use the portable ".c.x" form, since that leads
# prerequisites to be ignored:
# <http://lists.gnutls.org/pipermail/gnutls-devel/2013-September/006453.html>.
%.x: %.c $(GENERATED_BINDINGS)
	$(guile_snarf) -o $@ $< $(snarfcppopts)

# Target used by doc/Makefile, to create all built sources necessary
# for generating the manual.

.PHONY: built-sources
built-sources: $(BUILT_SOURCES)