1 ## Process this file with Automake to create Makefile.in
3 ## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007,
4 ## 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
6 ## This file is part of GUILE.
8 ## GUILE is free software; you can redistribute it and/or modify it
9 ## under the terms of the GNU Lesser General Public License as
10 ## published by the Free Software Foundation; either version 3, or
11 ## (at your option) any later version.
13 ## GUILE is distributed in the hope that it will be useful, but
14 ## WITHOUT ANY WARRANTY; without even the implied warranty of
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ## GNU Lesser General Public License for more details.
18 ## You should have received a copy of the GNU Lesser General Public
19 ## License along with GUILE; see the file COPYING.LESSER. If not,
20 ## write to the Free Software Foundation, Inc., 51 Franklin Street,
21 ## Fifth Floor, Boston, MA 02110-1301 USA
23 include $(top_srcdir)/am/snarf
25 AUTOMAKE_OPTIONS = gnu
27 ## Prevent automake from adding extra -I options
30 # Override Automake's `DEFAULT_INCLUDES'. By default, it contains
31 # "-I$(srcdir)", which causes problems on Tru64 where our "random.h"
32 # is picked up by <stdlib.h> instead of the libc's <random.h>.
35 ## Check for headers in $(srcdir)/.., so that #include
36 ## <libguile/MUMBLE.h> will find MUMBLE.h in this dir when we're
37 ## building. Also look for Gnulib headers in `lib'.
38 AM_CPPFLAGS = -DBUILDING_LIBGUILE=1 -I$(top_srcdir) -I$(top_builddir) \
39 -I$(top_srcdir)/lib -I$(top_builddir)/lib $(LIBFFI_CFLAGS)
41 AM_CFLAGS = $(GCC_CFLAGS) $(CFLAG_VISIBILITY)
43 ## The Gnulib Libtool archive.
44 gnulib_library = $(top_builddir)/lib/libgnu.la
46 ETAGS_ARGS = --regex='/SCM_\(GLOBAL_\)?\(G?PROC\|G?PROC1\|SYMBOL\|VCELL\|CONST_LONG\).*\"\([^\"]\)*\"/\3/' \
47 --regex='/[ \t]*SCM_[G]?DEFINE1?[ \t]*(\([^,]*\),[^,]*/\1/'
49 lib_LTLIBRARIES = libguile-@GUILE_EFFECTIVE_VERSION@.la
52 noinst_PROGRAMS = guile_filter_doc_snarfage gen-scmconfig
54 gen_scmconfig_SOURCES = gen-scmconfig.c
56 ## Override default rule; this should be compiled for BUILD host. Note
57 ## that we don't add $(AM_CPPFLAGS) here, as we need to run this
58 ## program, but $(top_srcdir)/lib has a gnulib configured for the
59 ## target. Instead we manually add $(top_builddir), in order to pick up
60 ## the generated config.h and gen-scmconfig.h. Nothing else from Guile
61 ## is included by this code generator.
62 gen-scmconfig.$(OBJEXT): gen-scmconfig.c
64 if [ "$(cross_compiling)" = "yes" ]; then \
65 $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) -I$(top_builddir) \
68 $(COMPILE) -c -o $@ $<; \
71 ## Override default rule; this should run on BUILD host.
72 gen-scmconfig$(EXEEXT): $(gen_scmconfig_OBJECTS) $(gen_scmconfig_DEPENDENCIES)
74 rm -f gen-scmconfig$(EXEEXT); \
75 if [ "$(cross_compiling)" = "yes" ]; then \
76 $(CCLD_FOR_BUILD) -o $@ $(gen_scmconfig_OBJECTS); \
78 $(LINK) $(gen_scmconfig_OBJECTS) $(LDADD) $(LIBS); \
81 scmconfig.h: ${top_builddir}/config.h gen-scmconfig$(EXEEXT)
82 $(AM_V_GEN)(rm -f scmconfig.h.tmp; \
83 cat $(srcdir)/scmconfig.h.top > scmconfig.h.tmp; \
84 ./gen-scmconfig$(EXEEXT) >> scmconfig.h.tmp; \
85 chmod 444 scmconfig.h.tmp; \
87 mv scmconfig.h.tmp scmconfig.h)
90 guile_filter_doc_snarfage_SOURCES = c-tokenize.c
92 ## Override default rule; this should be compiled for BUILD host.
93 ## For some reason, OBJEXT does not include the dot
94 c-tokenize.$(OBJEXT): c-tokenize.c
96 if [ "$(cross_compiling)" = "yes" ]; then \
97 $(CC_FOR_BUILD) -I$(top_builddir) -c -o $@ $<; \
99 $(COMPILE) -c -o $@ $<; \
102 ## Override default rule; this should run on BUILD host.
103 guile_filter_doc_snarfage$(EXEEXT): $(guile_filter_doc_snarfage_OBJECTS) $(guile_filter_doc_snarfage_DEPENDENCIES)
105 rm -f guile_filter_doc_snarfage$(EXEEXT); \
106 if [ "$(cross_compiling)" = "yes" ]; then \
107 $(CCLD_FOR_BUILD) -o $@ $(guile_filter_doc_snarfage_OBJECTS); \
109 $(LINK) $(guile_filter_doc_snarfage_OBJECTS) $(LDADD) $(gnulib_library) $(LIBS); \
113 guile_SOURCES = guile.c
114 guile_CFLAGS = $(GUILE_CFLAGS) $(AM_CFLAGS)
115 guile_LDADD = libguile-@GUILE_EFFECTIVE_VERSION@.la
116 guile_LDFLAGS = $(GUILE_CFLAGS)
118 libguile_@GUILE_EFFECTIVE_VERSION@_la_CFLAGS = $(GUILE_CFLAGS) $(AM_CFLAGS)
120 libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES = \
155 generalized-arrays.c \
156 generalized-vectors.c \
258 generalized-arrays.x \
259 generalized-vectors.x \
322 DOT_X_FILES += frames.x instructions.x objcodes.x programs.x vm.x
324 EXTRA_DOT_X_FILES = @EXTRA_DOT_X_FILES@
359 generalized-arrays.doc \
360 generalized-vectors.doc \
422 EXTRA_DOT_DOC_FILES = @EXTRA_DOT_DOC_FILES@
424 DOT_I_FILES = vm-i-system.i vm-i-scheme.i vm-i-loader.i
427 $(AM_V_GEN)$(GREP) '^VM_DEFINE' $< > $@
429 BUILT_SOURCES = cpp-E.c cpp-SIG.c libpath.h \
431 $(DOT_I_FILES) $(DOT_X_FILES) $(EXTRA_DOT_X_FILES)
433 # Force the generation of `guile-procedures.texi' because the top-level
434 # Makefile expects it to be built.
435 all-local: guile-procedures.texi
437 EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES = _scm.h \
438 memmove.c strerror.c \
439 dynl.c regex-posix.c \
440 posix.c net_db.c socket.c \
441 debug-malloc.c mkstemp.c \
445 ## delete guile-snarf.awk from the installation bindir, in case it's
446 ## lingering there due to an earlier guile version not having been
449 rm -f $(DESTDIR)$(bindir)/guile-snarf.awk
451 install-data-local: libguile-2.0-gdb.scm
452 @$(MKDIR_P) $(DESTDIR)$(libdir)
453 ## We want to install libguile-2.0-gdb.scm as SOMETHING-gdb.scm.
454 ## SOMETHING is the full name of the final library. We want to ignore
455 ## symlinks, the .la file, and any previous -gdb.py file. This is
456 ## inherently fragile, but there does not seem to be a better option,
457 ## because libtool hides the real names from us. (Trick courtesy of
459 @here=`pwd`; cd $(DESTDIR)$(libdir); \
460 for file in libguile-@GUILE_EFFECTIVE_VERSION@*; do \
464 *) if test -h $$file; then \
471 echo " $(INSTALL_DATA) libguile-2.0-gdb.scm \
472 $(DESTDIR)$(libdir)/$$libname-gdb.scm"; \
473 $(INSTALL_DATA) libguile-2.0-gdb.scm \
474 $(DESTDIR)$(libdir)/$$libname-gdb.scm
476 ## This is kind of nasty... there are ".c" files that we don't want to
477 ## compile, since they are #included. So instead we list them here.
478 ## Perhaps we can deal with them normally once the merge seems to be
480 noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c \
484 private-gc.h private-options.h ports-internal.h
487 noinst_HEADERS += vm-engine.c vm-i-system.c vm-i-scheme.c vm-i-loader.c
489 libguile_@GUILE_EFFECTIVE_VERSION@_la_DEPENDENCIES = @LIBLOBJS@
491 libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD = \
492 @LIBLOBJS@ $(gnulib_library) $(LTLIBGMP) $(LTLIBLTDL)
494 # Libtool version info.
495 version_info = @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@
497 libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS = \
498 $(BDW_GC_LIBS) $(LIBFFI_LIBS) \
511 $(LIB_CLOCK_GETTIME) \
520 -version-info $(version_info) \
521 -export-dynamic -no-undefined \
524 if HAVE_LD_VERSION_SCRIPT
526 libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS += -Wl,--version-script="$(srcdir)/libguile.map"
528 endif HAVE_LD_VERSION_SCRIPT
531 # These are headers visible as <guile/mumble.h>
534 # These are headers visible as <libguile/mumble.h>.
535 modincludedir = $(pkgincludedir)/$(GUILE_EFFECTIVE_VERSION)/libguile
536 modinclude_HEADERS = \
575 generalized-arrays.h \
576 generalized-vectors.h \
655 nodist_modinclude_HEADERS = version.h scmconfig.h
657 bin_SCRIPTS = guile-snarf
659 # We can re-enable install for some of these if/when they are documented
660 # and people feel like maintaining them. For now, this is not the case.
661 noinst_SCRIPTS = guile-snarf-docs
663 EXTRA_DIST = ChangeLog-scm ChangeLog-threads \
664 ChangeLog-1996-1999 ChangeLog-2000 ChangeLog-2008 \
665 guile-func-name-check \
666 cpp-E.syms cpp-E.c cpp-SIG.syms cpp-SIG.c \
668 scmconfig.h.top libgettext.h unidata_to_charset.pl libguile.map \
670 # $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES) \
671 # guile-procedures.txt guile.texi
673 ## FIXME: Consider using timestamp file, to avoid unnecessary rebuilds.
674 libpath.h: $(srcdir)/Makefile.in $(top_builddir)/config.status
676 @echo '/* generated by Makefile */' > libpath.tmp
677 @echo '#define SCM_PKGDATA_DIR "$(pkgdatadir)"' >> libpath.tmp
678 @echo '#define SCM_LIBRARY_DIR "$(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)"'>>libpath.tmp
679 @echo '#define SCM_SITE_DIR "$(sitedir)"' >> libpath.tmp
680 @echo '#define SCM_GLOBAL_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp
681 @echo '#define SCM_LIB_DIR "$(libdir)"' >> libpath.tmp
682 @echo '#define SCM_EXTENSIONS_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions"' >> libpath.tmp
683 @echo '#define SCM_CCACHE_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/ccache"' >> libpath.tmp
684 @echo '#define SCM_SITE_CCACHE_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache"' >> libpath.tmp
685 @echo '#define SCM_EFFECTIVE_VERSION "$(GUILE_EFFECTIVE_VERSION)"' >> libpath.tmp
686 @echo '#define SCM_BUILD_INFO { \' >> libpath.tmp
687 @echo ' { "srcdir", "'"`cd @srcdir@; pwd`"'" }, \' >> libpath.tmp
688 @echo ' { "top_srcdir", "@top_srcdir_absolute@" }, \' >> libpath.tmp
689 @echo ' { "prefix", "@prefix@" }, \' >> libpath.tmp
690 @echo ' { "exec_prefix", "@exec_prefix@" }, \' >> libpath.tmp
691 @echo ' { "bindir", "@bindir@" }, \' >> libpath.tmp
692 @echo ' { "sbindir", "@sbindir@" }, \' >> libpath.tmp
693 @echo ' { "libexecdir", "@libexecdir@" }, \' >> libpath.tmp
694 @echo ' { "datadir", "@datadir@" }, \' >> libpath.tmp
695 @echo ' { "sysconfdir", "@sysconfdir@" }, \' >> libpath.tmp
696 @echo ' { "sharedstatedir", "@sharedstatedir@" }, \' >> libpath.tmp
697 @echo ' { "localstatedir", "@localstatedir@" }, \' >> libpath.tmp
698 @echo ' { "libdir", "@libdir@" }, \' >> libpath.tmp
699 @echo ' { "ccachedir", SCM_CCACHE_DIR }, \' >> libpath.tmp
700 @echo ' { "infodir", "@infodir@" }, \' >> libpath.tmp
701 @echo ' { "mandir", "@mandir@" }, \' >> libpath.tmp
702 @echo ' { "includedir", "@includedir@" }, \' >> libpath.tmp
703 @echo ' { "pkgdatadir", "$(pkgdatadir)" }, \' >> libpath.tmp
704 @echo ' { "pkglibdir", "$(pkglibdir)" }, \' >> libpath.tmp
705 @echo ' { "pkgincludedir", "$(pkgincludedir)" }, \' \
707 @echo ' { "extensiondir", "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions" }, \' >> libpath.tmp
708 @echo ' { "guileversion", "@GUILE_VERSION@" }, \' >> libpath.tmp
709 @echo ' { "libguileinterface", "@LIBGUILE_INTERFACE@" }, \' \
711 @echo ' { "LIBS", "@GUILE_LIBS@" }, \' >> libpath.tmp
712 @echo ' { "CFLAGS", "@GUILE_CFLAGS@" }, \' >> libpath.tmp
713 @echo ' { "buildstamp", "'`date -u +'%Y-%m-%d %T'`'" }, \' >> libpath.tmp
714 @echo '}' >> libpath.tmp
715 $(AM_V_GEN)mv libpath.tmp libpath.h
718 snarfcppopts = $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
723 $(AM_V_SNARF)$(GUILE_SNARF) -o $@ $< $(snarfcppopts)
725 $(AM_V_SNARF)./guile-snarf-docs -o $@ $< -- $(snarfcppopts)
727 $(DOT_X_FILES) $(EXTRA_DOT_X_FILES): scmconfig.h snarf.h guile-snarf.in version.h
729 $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES): scmconfig.h snarf.h guile-snarf-docs.in guile_filter_doc_snarfage$(EXEEXT)
736 alldotdocfiles = $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES)
737 snarf2checkedtexi = GUILE_INSTALL_LOCALE=1 GUILE_AUTO_COMPILE=0 \
738 $(top_builddir)/meta/uninstalled-env guild snarf-check-and-output-texi
739 dotdoc2texi = cat $(alldotdocfiles) | $(snarf2checkedtexi)
741 guile.texi: $(alldotdocfiles) guile$(EXEEXT)
742 $(dotdoc2texi) --manual > $@ || { rm $@; false; }
744 guile-procedures.texi: $(alldotdocfiles) guile$(EXEEXT)
745 $(AM_V_GEN)$(dotdoc2texi) > $@ || { rm $@; false; }
747 c-tokenize.c: c-tokenize.lex
748 flex -t $(srcdir)/c-tokenize.lex > $@ || { rm $@; false; }
750 ## Add -MG to make the .x magic work with auto-dep code.
751 MKDEP = gcc -M -MG $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
754 # This page is for maintenance of the lists of CPP symbols that are eventually
755 # included in error.c (‘errno’ values: E*) and posix.c (signal names: SIG*),
756 # in the funcs scm_init_{error,posix}, respectively.
758 # The lists (files cpp-{E,SIG}.syms) are not included verbatim, but processed
759 # (via pattern rule ‘.syms.c’ below) so that each CPP symbol is transformed to
760 # fragment of #ifdef'd C code that defines a Scheme variable of the same name.
761 # The resulting files, cpp-{E,SIG}.c, are the ones #include:d.
763 # To maintain the (source) lists of symbols, we use a GCC-specific feature
764 # to list all symbols #define:d when expanding <{errno,signal}.h>, grep
765 # the output for {E,SIG}*, massage the result into a usable form, and
766 # construct a union of the current and new symbols. This is written to
767 # files cpp-{E,SIG}.syms.NEW for review. If things look ok, you can then
768 # "mv foo.NEW foo" and commit. Generating the foo.NEW files and showing
769 # an informative message is the job of targets chknew-{E,SIG}.
771 # For each line in foo.syms, transform:
775 # scm_c_define ("SYMBOL", scm_from_int (SYMBOL));
777 # writing output to foo.c. We use a while-read loop instead of a
778 # one-line sed script because some seds (e.g., FreeBSD) don't read
779 # '\n' as a newline (like GNU sed does). Sad, but true.
782 cat $< | while read sym ; do \
783 echo "#ifdef $$sym" ; \
784 echo "scm_c_define (\"$$sym\", scm_from_int ($$sym));" ; \
789 # Write $(srcdir)/cpp-{E,SIG}.syms.NEW if there are any not-yet-seen
790 # ("new" to us) E* or SIG* symbols in <errno.h> or <signal.h>, respectively.
791 chknew-E chknew-SIG: \
792 @bit=`echo $@ | sed s/^chknew-//` ; \
793 old="$(srcdir)/cpp-$$bit.syms" ; \
794 echo "#include <$${bit}.h>" \
795 | sed 's/E/errno/;s/SIG/signal/' \
797 | sed 's/^#define //;/^'$$bit'[A-Z][A-Z]*/!d;s/ .*//' \
798 | sort | diff -u $$old - | sed '1,2d;/^+/!d;s/^.//' \
800 if [ -s TMP ] ; then new="$$old.NEW" ; \
801 cat $$old TMP | sort > $$new ; \
802 echo "$$new: `sed -n '$$=' TMP` new symbol(s)." ; \
804 else echo "No new symbols found." ; \
810 scmconfig.h scmconfig.h.tmp
812 CLEANFILES = libpath.h *.x *.doc guile-procedures.txt guile-procedures.texi guile.texi \
815 MAINTAINERCLEANFILES = c-tokenize.c