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) -DCROSS_COMPILING=1 -I$(top_builddir) \
100 $(COMPILE) -c -o "$@" "$<"; \
103 ## Override default rule; this should run on BUILD host.
104 guile_filter_doc_snarfage$(EXEEXT): $(guile_filter_doc_snarfage_OBJECTS) $(guile_filter_doc_snarfage_DEPENDENCIES)
106 rm -f guile_filter_doc_snarfage$(EXEEXT); \
107 if [ "$(cross_compiling)" = "yes" ]; then \
108 $(CCLD_FOR_BUILD) -o $@ $(guile_filter_doc_snarfage_OBJECTS); \
110 $(LINK) $(guile_filter_doc_snarfage_OBJECTS) $(LDADD) $(gnulib_library) $(LIBS); \
114 guile_SOURCES = guile.c
115 guile_CFLAGS = $(GUILE_CFLAGS) $(AM_CFLAGS)
116 guile_LDADD = libguile-@GUILE_EFFECTIVE_VERSION@.la
117 guile_LDFLAGS = $(GUILE_CFLAGS)
119 libguile_@GUILE_EFFECTIVE_VERSION@_la_CFLAGS = $(GUILE_CFLAGS) $(AM_CFLAGS)
121 libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES = \
157 generalized-arrays.c \
158 generalized-vectors.c \
263 generalized-arrays.x \
264 generalized-vectors.x \
332 EXTRA_DOT_X_FILES = @EXTRA_DOT_X_FILES@
367 generalized-arrays.doc \
368 generalized-vectors.doc \
432 EXTRA_DOT_DOC_FILES = @EXTRA_DOT_DOC_FILES@
434 vm-operations.h: vm-engine.c
435 @echo '/* This file was generated automatically from $<; do not' > $@
436 @echo ' edit. See the source file for copyright information. */' >> $@
438 @echo "#define FOR_EACH_VM_OPERATION(M) \\" >> $@
439 $(AM_V_GEN)$(GREP) '^ *VM_DEFINE_OP' $< \
440 | sed -e 's,VM_DEFINE_OP (\(.*\)).*, M (\1) \\,' >> $@
443 BUILT_SOURCES = cpp-E.c cpp-SIG.c libpath.h \
445 $(DOT_I_FILES) vm-operations.h $(DOT_X_FILES) $(EXTRA_DOT_X_FILES)
447 # Force the generation of `guile-procedures.texi' because the top-level
448 # Makefile expects it to be built.
449 all-local: guile-procedures.texi
451 EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES = _scm.h \
452 memmove.c strerror.c \
453 dynl.c regex-posix.c \
454 posix.c net_db.c socket.c \
455 debug-malloc.c mkstemp.c \
459 ## delete guile-snarf.awk from the installation bindir, in case it's
460 ## lingering there due to an earlier guile version not having been
463 rm -f $(DESTDIR)$(bindir)/guile-snarf.awk
465 install-data-hook: libguile-2.2-gdb.scm
466 @$(MKDIR_P) $(DESTDIR)$(libdir)
467 ## We want to install libguile-2.2-gdb.scm as SOMETHING-gdb.scm.
468 ## SOMETHING is the full name of the final library. We want to ignore
469 ## symlinks, the .la file, and any previous -gdb.py file. This is
470 ## inherently fragile, but there does not seem to be a better option,
471 ## because libtool hides the real names from us. (Trick courtesy of
473 @here=`pwd`; cd $(DESTDIR)$(libdir); \
474 for file in libguile-@GUILE_EFFECTIVE_VERSION@*; do \
478 *) if test -h $$file; then \
485 echo " $(INSTALL_DATA) $< \
486 $(DESTDIR)$(libdir)/$$libname-gdb.scm"; \
487 $(INSTALL_DATA) "$<" \
488 "$(DESTDIR)$(libdir)/$$libname-gdb.scm"
490 # Remove the GDB support file and the Info 'dir' file that
491 # 'install-info' 5.x installs.
493 -rm "$(DESTDIR)$(libdir)/libguile-@GUILE_EFFECTIVE_VERSION@"*-gdb.scm
494 -rm -f "$(DESTDIR)$(infodir)/dir"
496 ## This is kind of nasty... there are ".c" files that we don't want to
497 ## compile, since they are #included. So instead we list them here.
498 ## Perhaps we can deal with them normally once the merge seems to be
500 noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c \
505 private-options.h ports-internal.h
508 noinst_HEADERS += vm-engine.c
510 libguile_@GUILE_EFFECTIVE_VERSION@_la_DEPENDENCIES = @LIBLOBJS@
512 libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD = \
513 @LIBLOBJS@ $(gnulib_library) $(LTLIBGMP) $(LTLIBLTDL)
515 # Libtool version info.
516 version_info = @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@
518 libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS = \
519 $(BDW_GC_LIBS) $(LIBFFI_LIBS) \
532 $(LIB_CLOCK_GETTIME) \
541 -version-info $(version_info) \
542 -export-dynamic -no-undefined \
545 if HAVE_LD_VERSION_SCRIPT
547 libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS += -Wl,--version-script="$(srcdir)/libguile.map"
549 endif HAVE_LD_VERSION_SCRIPT
552 # These are headers visible as <guile/mumble.h>
555 # These are headers visible as <libguile/mumble.h>.
556 modincludedir = $(pkgincludedir)/$(GUILE_EFFECTIVE_VERSION)/libguile
557 modinclude_HEADERS = \
597 generalized-arrays.h \
598 generalized-vectors.h \
679 nodist_modinclude_HEADERS = version.h scmconfig.h
681 bin_SCRIPTS = guile-snarf
683 # We can re-enable install for some of these if/when they are documented
684 # and people feel like maintaining them. For now, this is not the case.
685 noinst_SCRIPTS = guile-snarf-docs
687 EXTRA_DIST = ChangeLog-scm ChangeLog-threads \
688 ChangeLog-1996-1999 ChangeLog-2000 ChangeLog-2008 \
689 guile-func-name-check \
690 cpp-E.syms cpp-E.c cpp-SIG.syms cpp-SIG.c \
692 scmconfig.h.top libgettext.h unidata_to_charset.pl libguile.map \
694 # $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES) \
695 # guile-procedures.txt guile.texi
697 ## FIXME: Consider using timestamp file, to avoid unnecessary rebuilds.
698 libpath.h: $(srcdir)/Makefile.in $(top_builddir)/config.status
700 @echo '/* generated by Makefile */' > libpath.tmp
701 @echo '#define SCM_PKGDATA_DIR "$(pkgdatadir)"' >> libpath.tmp
702 @echo '#define SCM_LIBRARY_DIR "$(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)"'>>libpath.tmp
703 @echo '#define SCM_SITE_DIR "$(sitedir)"' >> libpath.tmp
704 @echo '#define SCM_GLOBAL_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp
705 @echo '#define SCM_LIB_DIR "$(libdir)"' >> libpath.tmp
706 @echo '#define SCM_EXTENSIONS_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions"' >> libpath.tmp
707 @echo '#define SCM_CCACHE_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/ccache"' >> libpath.tmp
708 @echo '#define SCM_SITE_CCACHE_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache"' >> libpath.tmp
709 @echo '#define SCM_EFFECTIVE_VERSION "$(GUILE_EFFECTIVE_VERSION)"' >> libpath.tmp
710 @echo '#define SCM_BUILD_INFO { \' >> libpath.tmp
711 @echo ' { "srcdir", "'"`cd @srcdir@; pwd`"'" }, \' >> libpath.tmp
712 @echo ' { "top_srcdir", "@top_srcdir_absolute@" }, \' >> libpath.tmp
713 @echo ' { "prefix", "@prefix@" }, \' >> libpath.tmp
714 @echo ' { "exec_prefix", "@exec_prefix@" }, \' >> libpath.tmp
715 @echo ' { "bindir", "@bindir@" }, \' >> libpath.tmp
716 @echo ' { "sbindir", "@sbindir@" }, \' >> libpath.tmp
717 @echo ' { "libexecdir", "@libexecdir@" }, \' >> libpath.tmp
718 @echo ' { "datadir", "@datadir@" }, \' >> libpath.tmp
719 @echo ' { "sysconfdir", "@sysconfdir@" }, \' >> libpath.tmp
720 @echo ' { "sharedstatedir", "@sharedstatedir@" }, \' >> libpath.tmp
721 @echo ' { "localstatedir", "@localstatedir@" }, \' >> libpath.tmp
722 @echo ' { "libdir", "@libdir@" }, \' >> libpath.tmp
723 @echo ' { "ccachedir", SCM_CCACHE_DIR }, \' >> libpath.tmp
724 @echo ' { "infodir", "@infodir@" }, \' >> libpath.tmp
725 @echo ' { "mandir", "@mandir@" }, \' >> libpath.tmp
726 @echo ' { "includedir", "@includedir@" }, \' >> libpath.tmp
727 @echo ' { "pkgdatadir", "$(pkgdatadir)" }, \' >> libpath.tmp
728 @echo ' { "pkglibdir", "$(pkglibdir)" }, \' >> libpath.tmp
729 @echo ' { "pkgincludedir", "$(pkgincludedir)" }, \' \
731 @echo ' { "extensiondir", "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions" }, \' >> libpath.tmp
732 @echo ' { "guileversion", "@GUILE_VERSION@" }, \' >> libpath.tmp
733 @echo ' { "libguileinterface", "@LIBGUILE_INTERFACE@" }, \' \
735 @echo ' { "LIBS", "@GUILE_LIBS@" }, \' >> libpath.tmp
736 @echo ' { "CFLAGS", "@GUILE_CFLAGS@" }, \' >> libpath.tmp
737 @echo ' { "buildstamp", "'`date -u +'%Y-%m-%d %T'`'" }, \' >> libpath.tmp
738 @echo '}' >> libpath.tmp
739 $(AM_V_GEN)mv libpath.tmp libpath.h
742 snarfcppopts = $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
747 $(AM_V_SNARF)$(GUILE_SNARF) -o $@ $< $(snarfcppopts)
749 $(AM_V_SNARF)./guile-snarf-docs -o $@ $< -- $(snarfcppopts)
751 $(DOT_X_FILES) $(EXTRA_DOT_X_FILES): scmconfig.h snarf.h guile-snarf.in version.h
753 $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES): scmconfig.h snarf.h guile-snarf-docs.in guile_filter_doc_snarfage$(EXEEXT)
760 alldotdocfiles = $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES)
761 snarf2checkedtexi = GUILE_AUTO_COMPILE=0 $(top_builddir)/meta/uninstalled-env guild snarf-check-and-output-texi
762 dotdoc2texi = cat $(alldotdocfiles) | $(snarf2checkedtexi)
764 guile.texi: $(alldotdocfiles) guile$(EXEEXT)
765 $(dotdoc2texi) --manual > $@ || { rm $@; false; }
767 guile-procedures.texi: $(alldotdocfiles) guile$(EXEEXT)
768 $(AM_V_GEN)$(dotdoc2texi) > $@ || { rm $@; false; }
770 c-tokenize.c: c-tokenize.lex
771 flex -t $(srcdir)/c-tokenize.lex > $@ || { rm $@; false; }
773 ## Add -MG to make the .x magic work with auto-dep code.
774 MKDEP = gcc -M -MG $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
777 # This page is for maintenance of the lists of CPP symbols that are eventually
778 # included in error.c (‘errno’ values: E*) and posix.c (signal names: SIG*),
779 # in the funcs scm_init_{error,posix}, respectively.
781 # The lists (files cpp-{E,SIG}.syms) are not included verbatim, but processed
782 # (via pattern rule ‘.syms.c’ below) so that each CPP symbol is transformed to
783 # fragment of #ifdef'd C code that defines a Scheme variable of the same name.
784 # The resulting files, cpp-{E,SIG}.c, are the ones #include:d.
786 # To maintain the (source) lists of symbols, we use a GCC-specific feature
787 # to list all symbols #define:d when expanding <{errno,signal}.h>, grep
788 # the output for {E,SIG}*, massage the result into a usable form, and
789 # construct a union of the current and new symbols. This is written to
790 # files cpp-{E,SIG}.syms.NEW for review. If things look ok, you can then
791 # "mv foo.NEW foo" and commit. Generating the foo.NEW files and showing
792 # an informative message is the job of targets chknew-{E,SIG}.
794 # For each line in foo.syms, transform:
798 # scm_c_define ("SYMBOL", scm_from_int (SYMBOL));
800 # writing output to foo.c. We use a while-read loop instead of a
801 # one-line sed script because some seds (e.g., FreeBSD) don't read
802 # '\n' as a newline (like GNU sed does). Sad, but true.
805 cat $< | while read sym ; do \
806 echo "#ifdef $$sym" ; \
807 echo "scm_c_define (\"$$sym\", scm_from_int ($$sym));" ; \
812 # Write $(srcdir)/cpp-{E,SIG}.syms.NEW if there are any not-yet-seen
813 # ("new" to us) E* or SIG* symbols in <errno.h> or <signal.h>, respectively.
814 chknew-E chknew-SIG: \
815 @bit=`echo $@ | sed s/^chknew-//` ; \
816 old="$(srcdir)/cpp-$$bit.syms" ; \
817 echo "#include <$${bit}.h>" \
818 | sed 's/E/errno/;s/SIG/signal/' \
820 | sed 's/^#define //;/^'$$bit'[A-Z][A-Z]*/!d;s/ .*//' \
821 | sort | diff -u $$old - | sed '1,2d;/^+/!d;s/^.//' \
823 if [ -s TMP ] ; then new="$$old.NEW" ; \
824 cat $$old TMP | sort > $$new ; \
825 echo "$$new: `sed -n '$$=' TMP` new symbol(s)." ; \
827 else echo "No new symbols found." ; \
833 scmconfig.h scmconfig.h.tmp
835 CLEANFILES = libpath.h *.x *.doc guile-procedures.txt guile-procedures.texi guile.texi
837 MAINTAINERCLEANFILES = c-tokenize.c