1## Process this file with Automake to create Makefile.in
2##
3##  	Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2008 Free Software Foundation, Inc.
4##
5##   This file is part of GUILE.
6##
7##   GUILE is free software; you can redistribute it and/or modify
8##   it under the terms of the GNU General Public License as
9##   published by the Free Software Foundation; either version 2, or
10##   (at your option) any later version.
11##
12##   GUILE is distributed in the hope that it will be useful, but
13##   WITHOUT ANY WARRANTY; without even the implied warranty of
14##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15##   GNU General Public License for more details.
16##
17##   You should have received a copy of the GNU General Public
18##   License along with GUILE; see the file COPYING.  If not, write
19##   to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
20##   Floor, Boston, MA 02110-1301 USA
21
22AUTOMAKE_OPTIONS = gnu
23
24## Prevent automake from adding extra -I options
25DEFS = @DEFS@
26
27# Override Automake's `DEFAULT_INCLUDES'.  By default, it contains
28# "-I$(srcdir)", which causes problems on Tru64 where our "random.h"
29# is picked up by <stdlib.h> instead of the libc's <random.h>.
30DEFAULT_INCLUDES =
31
32## Check for headers in $(srcdir)/.., so that #include
33## <libguile/MUMBLE.h> will find MUMBLE.h in this dir when we're
34## building.
35AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_builddir)
36
37ETAGS_ARGS = --regex='/SCM_\(GLOBAL_\)?\(G?PROC\|G?PROC1\|SYMBOL\|VCELL\|CONST_LONG\).*\"\([^\"]\)*\"/\3/' \
38   --regex='/[ \t]*SCM_[G]?DEFINE1?[ \t]*(\([^,]*\),[^,]*/\1/'
39
40lib_LTLIBRARIES = libguile.la
41bin_PROGRAMS = guile
42
43noinst_PROGRAMS = guile_filter_doc_snarfage gen-scmconfig
44
45gen_scmconfig_SOURCES = gen-scmconfig.c
46
47## Override default rule; this should be compiled for BUILD host.
48## For some reason, OBJEXT does not include the dot
49gen-scmconfig.$(OBJEXT): gen-scmconfig.c
50	if [ "$(cross_compiling)" = "yes" ]; then \
51		$(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) -c -o $@ $<; \
52	else \
53		$(COMPILE) -c -o $@ $<; \
54	fi
55
56## Override default rule; this should run on BUILD host.
57gen-scmconfig$(EXEEXT): $(gen_scmconfig_OBJECTS) $(gen_scmconfig_DEPENDENCIES)
58	@rm -f gen-scmconfig$(EXEEXT)
59	if [ "$(cross_compiling)" = "yes" ]; then \
60		$(CCLD_FOR_BUILD) -o $@ $(gen_scmconfig_OBJECTS); \
61	else \
62		$(LINK) $(gen_scmconfig_OBJECTS) $(LDADD) $(LIBS); \
63	fi
64
65scmconfig.h: ${top_builddir}/config.h gen-scmconfig$(EXEEXT)
66	rm -f scmconfig.h.tmp
67	cat $(srcdir)/scmconfig.h.top > scmconfig.h.tmp
68	./gen-scmconfig$(EXEEXT) >> scmconfig.h.tmp
69	chmod 444 scmconfig.h.tmp
70	rm -f scmconfig.h
71	mv scmconfig.h.tmp scmconfig.h
72
73guile_filter_doc_snarfage_SOURCES = c-tokenize.c
74
75## Override default rule; this should be compiled for BUILD host.
76## For some reason, OBJEXT does not include the dot
77c-tokenize.$(OBJEXT): c-tokenize.c
78	if [ "$(cross_compiling)" = "yes" ]; then \
79		$(CC_FOR_BUILD) $(DEFS) $(AM_CPPFLAGS) -c -o $@ $<; \
80	else \
81		$(COMPILE) -c -o $@ $<; \
82	fi
83
84## Override default rule; this should run on BUILD host.
85guile_filter_doc_snarfage$(EXEEXT): $(guile_filter_doc_snarfage_OBJECTS) $(guile_filter_doc_snarfage_DEPENDENCIES)
86	@rm -f guile_filter_doc_snarfage$(EXEEXT)
87	if [ "$(cross_compiling)" = "yes" ]; then \
88		$(CCLD_FOR_BUILD) -o $@ $(guile_filter_doc_snarfage_OBJECTS); \
89	else \
90		$(LINK) $(guile_filter_doc_snarfage_OBJECTS) $(LDADD) $(LIBS); \
91	fi
92
93
94guile_SOURCES = guile.c
95guile_CFLAGS = $(GUILE_CFLAGS)
96guile_LDADD = libguile.la
97guile_LDFLAGS = $(GUILE_CFLAGS)
98
99libguile_la_CFLAGS = $(GUILE_CFLAGS)
100
101libguile_la_SOURCES = alist.c arbiters.c async.c backtrace.c boolean.c	\
102    chars.c continuations.c convert.c debug.c deprecation.c		\
103    deprecated.c discouraged.c dynwind.c environments.c eq.c error.c	\
104    eval.c evalext.c extensions.c feature.c fluids.c fports.c		\
105    futures.c gc.c gc-mark.c gc-segment.c gc-malloc.c gc-card.c		\
106    gc-freelist.c gc_os_dep.c gdbint.c gh_data.c gh_eval.c gh_funcs.c	\
107    gh_init.c gh_io.c gh_list.c gh_predicates.c goops.c gsubr.c		\
108    guardians.c hash.c hashtab.c hooks.c i18n.c init.c inline.c		\
109    ioext.c keywords.c lang.c list.c load.c macros.c mallocs.c		\
110    modules.c numbers.c objects.c objprop.c options.c pairs.c ports.c	\
111    print.c procprop.c procs.c properties.c random.c rdelim.c read.c	\
112    root.c rw.c scmsigs.c script.c simpos.c smob.c sort.c srcprop.c	\
113    stackchk.c stacks.c stime.c strings.c srfi-4.c srfi-13.c srfi-14.c	\
114    strorder.c strports.c struct.c symbols.c threads.c null-threads.c	\
115    throw.c values.c variable.c vectors.c version.c vports.c weaks.c	\
116    ramap.c unif.c
117
118DOT_X_FILES = alist.x arbiters.x async.x backtrace.x boolean.x chars.x	\
119    continuations.x debug.x deprecation.x deprecated.x discouraged.x	\
120    dynl.x dynwind.x environments.x eq.x error.x eval.x evalext.x	\
121    extensions.x feature.x fluids.x fports.x futures.x gc.x gc-mark.x	\
122    gc-segment.x gc-malloc.x gc-card.x goops.x gsubr.x guardians.x	\
123    hash.x hashtab.x hooks.x i18n.x init.x ioext.x keywords.x lang.x	\
124    list.x load.x macros.x mallocs.x modules.x numbers.x objects.x	\
125    objprop.x options.x pairs.x ports.x print.x procprop.x procs.x	\
126    properties.x random.x rdelim.x read.x root.x rw.x scmsigs.x		\
127    script.x simpos.x smob.x sort.x srcprop.x stackchk.x stacks.x	\
128    stime.x strings.x srfi-4.x srfi-13.x srfi-14.x strorder.x		\
129    strports.x struct.x symbols.x threads.x throw.x values.x		\
130    variable.x vectors.x version.x vports.x weaks.x ramap.x unif.x
131
132EXTRA_DOT_X_FILES = @EXTRA_DOT_X_FILES@
133
134DOT_DOC_FILES = alist.doc arbiters.doc async.doc backtrace.doc		\
135    boolean.doc chars.doc continuations.doc debug.doc deprecation.doc	\
136    deprecated.doc discouraged.doc dynl.doc dynwind.doc			\
137    environments.doc eq.doc error.doc eval.doc evalext.doc		\
138    extensions.doc feature.doc fluids.doc fports.doc futures.doc	\
139    gc.doc goops.doc gsubr.doc gc-mark.doc gc-segment.doc		\
140    gc-malloc.doc gc-card.doc guardians.doc hash.doc hashtab.doc	\
141    hooks.doc i18n.doc init.doc ioext.doc keywords.doc lang.doc		\
142    list.doc load.doc macros.doc mallocs.doc modules.doc numbers.doc	\
143    objects.doc objprop.doc options.doc pairs.doc ports.doc print.doc	\
144    procprop.doc procs.doc properties.doc random.doc rdelim.doc		\
145    read.doc root.doc rw.doc scmsigs.doc script.doc simpos.doc		\
146    smob.doc sort.doc srcprop.doc stackchk.doc stacks.doc stime.doc	\
147    strings.doc srfi-4.doc srfi-13.doc srfi-14.doc strorder.doc		\
148    strports.doc struct.doc symbols.doc threads.doc throw.doc		\
149    values.doc variable.doc vectors.doc version.doc vports.doc		\
150    weaks.doc ramap.doc unif.doc
151
152EXTRA_DOT_DOC_FILES = @EXTRA_DOT_DOC_FILES@
153
154BUILT_SOURCES = cpp_err_symbols.c cpp_sig_symbols.c libpath.h \
155    version.h scmconfig.h \
156    $(DOT_X_FILES) $(EXTRA_DOT_X_FILES)
157
158EXTRA_libguile_la_SOURCES = _scm.h		\
159    inet_aton.c memmove.c putenv.c strerror.c	\
160    dynl.c regex-posix.c			\
161    filesys.c posix.c net_db.c socket.c		\
162    debug-malloc.c mkstemp.c	\
163    win32-uname.c win32-dirent.c win32-socket.c
164
165## delete guile-snarf.awk from the installation bindir, in case it's
166## lingering there due to an earlier guile version not having been
167## wiped out.
168install-exec-hook:
169	rm -f $(DESTDIR)$(bindir)/guile-snarf.awk
170
171## This is kind of nasty... there are ".c" files that we don't want to
172## compile, since they are #included.  So instead we list them here.
173## Perhaps we can deal with them normally once the merge seems to be
174## working.
175noinst_HEADERS = convert.i.c					\
176                 conv-integer.i.c conv-uinteger.i.c		\
177                 srfi-4.i.c					\
178                 quicksort.i.c                                  \
179                 win32-uname.h win32-dirent.h win32-socket.h	\
180	         private-gc.h
181
182libguile_la_DEPENDENCIES = @LIBLOBJS@
183libguile_la_LIBADD = @LIBLOBJS@
184libguile_la_LDFLAGS = @LTLIBINTL@ -version-info @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@ -export-dynamic -no-undefined
185
186# These are headers visible as <guile/mumble.h>
187pkginclude_HEADERS = gh.h
188
189# These are headers visible as <libguile/mumble.h>.
190modincludedir = $(includedir)/libguile
191modinclude_HEADERS = __scm.h alist.h arbiters.h async.h backtrace.h	\
192    boolean.h chars.h continuations.h convert.h debug.h debug-malloc.h	\
193    deprecation.h deprecated.h discouraged.h dynl.h dynwind.h		\
194    environments.h eq.h error.h eval.h evalext.h extensions.h		\
195    feature.h filesys.h fluids.h fports.h futures.h gc.h		\
196    gdb_interface.h gdbint.h goops.h gsubr.h guardians.h hash.h		\
197    hashtab.h hooks.h i18n.h init.h inline.h ioext.h iselect.h		\
198    keywords.h lang.h list.h load.h macros.h mallocs.h modules.h	\
199    net_db.h numbers.h objects.h objprop.h options.h pairs.h ports.h	\
200    posix.h regex-posix.h print.h procprop.h procs.h properties.h	\
201    random.h ramap.h rdelim.h read.h root.h rw.h scmsigs.h validate.h	\
202    script.h simpos.h smob.h snarf.h socket.h sort.h srcprop.h		\
203    stackchk.h stacks.h stime.h strings.h srfi-4.h srfi-13.h srfi-14.h	\
204    strorder.h strports.h struct.h symbols.h tags.h threads.h		\
205    pthread-threads.h null-threads.h throw.h unif.h values.h		\
206    variable.h vectors.h vports.h weaks.h
207
208nodist_modinclude_HEADERS = version.h scmconfig.h
209
210bin_SCRIPTS = guile-snarf
211
212# We can re-enable install for some of these if/when they are documented
213# and people feel like maintaining them.  For now, this is not the case.
214noinst_SCRIPTS = guile-doc-snarf guile-snarf-docs guile-func-name-check
215
216EXTRA_DIST = ChangeLog-gh ChangeLog-scm ChangeLog-threads		\
217    ChangeLog-1996-1999 ChangeLog-2000 ChangeLog-2008 cpp_signal.c	\
218    cpp_errno.c cpp_err_symbols.in cpp_err_symbols.c			\
219    cpp_sig_symbols.c cpp_sig_symbols.in cpp_cnvt.awk			\
220    c-tokenize.lex version.h.in						\
221    scmconfig.h.top gettext.h measure-hwm.scm
222#    $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES) \
223#    guile-procedures.txt guile.texi
224
225## We use @-...-@ as the substitution brackets here, instead of the
226## usual @...@, so autoconf doesn't go and substitute the values
227## directly into the left-hand sides of the sed substitutions.  *sigh*
228version.h: version.h.in
229	sed < $(srcdir)/version.h.in > $@.tmp \
230	  -e s:@-GUILE_MAJOR_VERSION-@:${GUILE_MAJOR_VERSION}: \
231	  -e s:@-GUILE_MINOR_VERSION-@:${GUILE_MINOR_VERSION}: \
232	  -e s:@-GUILE_MICRO_VERSION-@:${GUILE_MICRO_VERSION}:
233	mv $@.tmp $@
234
235## FIXME: Consider using timestamp file, to avoid unnecessary rebuilds.
236libpath.h: $(srcdir)/Makefile.in  $(top_builddir)/config.status
237	@echo "Generating libpath.h..."
238	@rm -f libpath.tmp
239	@echo '/* generated by Makefile */' > libpath.tmp
240	@echo '#define SCM_PKGDATA_DIR "$(pkgdatadir)"' >> libpath.tmp
241	@echo '#define SCM_LIBRARY_DIR "$(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)"'>>libpath.tmp
242	@echo '#define SCM_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp
243	@echo '#define SCM_BUILD_INFO { \' >> libpath.tmp
244	@echo '	{ "srcdir", "'"`cd @srcdir@; pwd`"'" }, \' >> libpath.tmp
245	@echo ' { "top_srcdir",    "@top_srcdir_absolute@" }, \' >> libpath.tmp
246	@echo '	{ "prefix",	   "@prefix@" }, \' >> libpath.tmp
247	@echo '	{ "exec_prefix",   "@exec_prefix@" }, \' >> libpath.tmp
248	@echo '	{ "bindir",	   "@bindir@" }, \' >> libpath.tmp
249	@echo '	{ "sbindir",	   "@sbindir@" }, \' >> libpath.tmp
250	@echo '	{ "libexecdir",	   "@libexecdir@" }, \' >> libpath.tmp
251	@echo '	{ "datadir",	   "@datadir@" }, \' >> libpath.tmp
252	@echo '	{ "sysconfdir",	   "@sysconfdir@" }, \' >> libpath.tmp
253	@echo '	{ "sharedstatedir", "@sharedstatedir@" }, \' >> libpath.tmp
254	@echo '	{ "localstatedir", "@localstatedir@" }, \' >> libpath.tmp
255	@echo '	{ "libdir",	   "@libdir@" }, \' >> libpath.tmp
256	@echo '	{ "infodir",	   "@infodir@" }, \' >> libpath.tmp
257	@echo '	{ "mandir",	   "@mandir@" }, \' >> libpath.tmp
258	@echo '	{ "includedir",	   "@includedir@" }, \' >> libpath.tmp
259	@echo '	{ "pkgdatadir",	   "$(datadir)/@PACKAGE@" }, \' >> libpath.tmp
260	@echo '	{ "pkglibdir",	   "$(libdir)/@PACKAGE@" }, \' >> libpath.tmp
261	@echo '	{ "pkgincludedir", "$(includedir)/@PACKAGE@" }, \' \
262		>> libpath.tmp
263	@echo '	{ "guileversion", "@GUILE_VERSION@" }, \' >> libpath.tmp
264	@echo '	{ "libguileinterface", "@LIBGUILE_INTERFACE@" }, \' \
265		>> libpath.tmp
266	@echo '	{ "LIBS",	   "@GUILE_LIBS@" }, \' >> libpath.tmp
267	@echo '	{ "CFLAGS",	   "@GUILE_CFLAGS@" }, \' >> libpath.tmp
268	@echo '	{ "buildstamp",    "'"`date`"'" }, \' >> libpath.tmp
269	@echo '}' >> libpath.tmp
270	@mv libpath.tmp libpath.h
271
272
273snarfcppopts = $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
274
275SUFFIXES = .x .doc
276.c.x:
277	./guile-snarf -o $@ $< $(snarfcppopts)
278.c.doc:
279	-$(AWK) -f ./guile-func-name-check $<
280	(./guile-snarf-docs $(snarfcppopts) $< | \
281	./guile_filter_doc_snarfage$(EXEEXT) --filter-snarfage) > $@ || { rm $@; false; }
282
283$(DOT_X_FILES) $(EXTRA_DOT_X_FILES): scmconfig.h snarf.h guile-snarf.in
284
285$(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES): scmconfig.h snarf.h guile-snarf-docs.in guile_filter_doc_snarfage$(EXEEXT)
286
287error.x: cpp_err_symbols.c
288posix.x: cpp_sig_symbols.c
289load.x: libpath.h
290
291include $(top_srcdir)/am/pre-inst-guile
292
293alldotdocfiles    = $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES)
294snarf2checkedtexi = GUILE="$(GUILE_FOR_BUILD)" $(top_srcdir)/scripts/snarf-check-and-output-texi
295dotdoc2texi       = cat $(alldotdocfiles) | $(snarf2checkedtexi)
296
297guile.texi: $(alldotdocfiles) guile$(EXEEXT)
298	$(dotdoc2texi) --manual > $@ || { rm $@; false; }
299
300guile-procedures.texi: $(alldotdocfiles) guile$(EXEEXT)
301	$(dotdoc2texi)          > $@ || { rm $@; false; }
302
303if HAVE_MAKEINFO
304
305guile-procedures.txt: guile-procedures.texi
306	rm -f $@
307	makeinfo --force -o $@ guile-procedures.texi || test -f $@
308
309else
310
311guile-procedures.txt: guile-procedures.texi
312	cp guile-procedures.texi $@
313
314endif
315
316# Stack limit calibration for `make check'.  (For why we do this, see
317# the comments in measure-hwm.scm.)  We're relying here on a couple of
318# bits of Automake magic.
319#
320# 1. The fact that "libguile" comes before "test-suite" in SUBDIRS in
321# our toplevel Makefile.am.  This ensures that the
322# stack-limit-calibration.scm "test" will be run before any of the
323# tests under test-suite.
324#
325# 2. The fact that each test is invoked as $TESTS_ENVIRONMENT $test.
326# This allows us to ensure that the test will be considered to have
327# passed, by using `true' as TESTS_ENVIRONMENT.
328#
329# Why don't we care about the test "actually passing"?  Because the
330# important thing about stack-limit-calibration.scm is just that it is
331# generated in the first place, so that other tests under test-suite
332# can use it.
333TESTS = stack-limit-calibration.scm
334TESTS_ENVIRONMENT = true
335
336stack-limit-calibration.scm: measure-hwm.scm guile$(EXEEXT)
337	$(preinstguile) -s $(srcdir)/measure-hwm.scm > $@
338
339c-tokenize.c: c-tokenize.lex
340	flex -t $(srcdir)/c-tokenize.lex > $@ || { rm $@; false; }
341
342schemelibdir = $(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)
343schemelib_DATA = guile-procedures.txt
344
345## Add -MG to make the .x magic work with auto-dep code.
346MKDEP = gcc -M -MG $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
347
348cpp_err_symbols.c: cpp_err_symbols.in cpp_cnvt.awk
349	$(AWK) -f $(srcdir)/cpp_cnvt.awk < $(srcdir)/cpp_err_symbols.in > \
350		cpp_err_symbols.tmp
351	mv cpp_err_symbols.tmp cpp_err_symbols.c
352
353cpp_sig_symbols.c: cpp_sig_symbols.in cpp_cnvt.awk
354	$(AWK) -f $(srcdir)/cpp_cnvt.awk < $(srcdir)/cpp_sig_symbols.in > \
355		cpp_sig_symbols.tmp
356	mv cpp_sig_symbols.tmp cpp_sig_symbols.c
357
358## Create a new version of the cpp_sig_symbols.in file, including all SIGXXX
359## macros defined on this platform.
360check_signals:
361	gcc -undef -dM -E $(srcdir)/cpp_signal.c | egrep ' SIG[A-Z]+' \
362	  | cut -f2 -d' ' | sort > cpp_sig_symbols_here
363	diff -u $(srcdir)/cpp_sig_symbols.in cpp_sig_symbols_here \
364          | egrep '^\+S' \
365	  | cut -c2- > cpp_sig_symbols_diff
366	if test -s cpp_sig_symbols_diff ; then \
367	  cat $(srcdir)/cpp_sig_symbols.in cpp_sig_symbols_diff \
368	    | sort > cpp_sig_symbols_new ;\
369	  echo "cpp_sig_symbols_new has the following additions:" ;\
370	  cat cpp_sig_symbols_diff ;\
371	else echo "No new symbols found."; \
372	fi
373
374## Likewise for cpp_err_symbols.in.
375check_errnos:
376	gcc -undef -dM -E $(srcdir)/cpp_errno.c | egrep ' E.+' \
377	  | cut -f2 -d' ' | sort > cpp_err_symbols_here
378	diff -u $(srcdir)/cpp_err_symbols.in cpp_err_symbols_here \
379          | egrep '^\+E' \
380	  | cut -c2- > cpp_err_symbols_diff
381	if test -s cpp_err_symbols_diff ; then \
382	  cat $(srcdir)/cpp_err_symbols.in cpp_err_symbols_diff \
383	    | sort > cpp_err_symbols_new ;\
384	  echo "cpp_err_symbols_new has the following additions:" ;\
385	  cat cpp_err_symbols_diff ;\
386	else echo "No new symbols found."; \
387	fi
388
389MOSTLYCLEANFILES = \
390	cpp_err_symbols_here cpp_err_symbols_diff cpp_err_symbols_new \
391	cpp_sig_symbols_here cpp_sig_symbols_diff cpp_sig_symbols_new \
392	version.h version.h.tmp \
393	scmconfig.h scmconfig.h.tmp stack-limit-calibration.scm
394
395CLEANFILES = libpath.h *.x *.doc guile-procedures.txt guile-procedures.texi guile.texi
396
397MAINTAINERCLEANFILES = c-tokenize.c
398