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 \
264 generalized-arrays.x \
265 generalized-vectors.x \
334 EXTRA_DOT_X_FILES = @EXTRA_DOT_X_FILES@
369 generalized-arrays.doc \
370 generalized-vectors.doc \
435 EXTRA_DOT_DOC_FILES = @EXTRA_DOT_DOC_FILES@
437 vm-operations.h: vm-engine.c
438 @echo '/* This file was generated automatically from $<; do not' > $@
439 @echo ' edit. See the source file for copyright information. */' >> $@
441 @echo "#define FOR_EACH_VM_OPERATION(M) \\" >> $@
442 $(AM_V_GEN)$(GREP) '^ *VM_DEFINE_OP' $< \
443 | sed -e 's,VM_DEFINE_OP (\(.*\)).*, M (\1) \\,' >> $@
446 BUILT_SOURCES = cpp-E.c cpp-SIG.c libpath.h \
448 $(DOT_I_FILES) vm-operations.h $(DOT_X_FILES) $(EXTRA_DOT_X_FILES)
450 # Force the generation of `guile-procedures.texi' because the top-level
451 # Makefile expects it to be built.
452 all-local: guile-procedures.texi
454 EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES = _scm.h \
455 memmove.c strerror.c \
456 dynl.c regex-posix.c \
457 posix.c net_db.c socket.c \
458 debug-malloc.c mkstemp.c \
462 ## delete guile-snarf.awk from the installation bindir, in case it's
463 ## lingering there due to an earlier guile version not having been
466 rm -f $(DESTDIR)$(bindir)/guile-snarf.awk
468 install-data-hook: libguile-2.2-gdb.scm
469 @$(MKDIR_P) $(DESTDIR)$(libdir)
470 ## We want to install libguile-2.2-gdb.scm as SOMETHING-gdb.scm.
471 ## SOMETHING is the full name of the final library. We want to ignore
472 ## symlinks, the .la file, and any previous -gdb.py file. This is
473 ## inherently fragile, but there does not seem to be a better option,
474 ## because libtool hides the real names from us. (Trick courtesy of
476 @here=`pwd`; cd $(DESTDIR)$(libdir); \
477 for file in libguile-@GUILE_EFFECTIVE_VERSION@*; do \
481 *) if test -h $$file; then \
488 echo " $(INSTALL_DATA) $< \
489 $(DESTDIR)$(libdir)/$$libname-gdb.scm"; \
490 $(INSTALL_DATA) "$<" \
491 "$(DESTDIR)$(libdir)/$$libname-gdb.scm"
493 # Remove the GDB support file and the Info 'dir' file that
494 # 'install-info' 5.x installs.
496 -rm "$(DESTDIR)$(libdir)/libguile-@GUILE_EFFECTIVE_VERSION@"*-gdb.scm
497 -rm -f "$(DESTDIR)$(infodir)/dir"
499 ## This is kind of nasty... there are ".c" files that we don't want to
500 ## compile, since they are #included. So instead we list them here.
501 ## Perhaps we can deal with them normally once the merge seems to be
503 noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c \
508 private-options.h ports-internal.h
511 noinst_HEADERS += vm-engine.c
513 libguile_@GUILE_EFFECTIVE_VERSION@_la_DEPENDENCIES = @LIBLOBJS@
515 libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD = \
516 @LIBLOBJS@ $(gnulib_library) $(LTLIBGMP) $(LTLIBLTDL)
518 # Libtool version info.
519 version_info = @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@
521 libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS = \
522 $(BDW_GC_LIBS) $(LIBFFI_LIBS) \
535 $(LIB_CLOCK_GETTIME) \
544 -version-info $(version_info) \
545 -export-dynamic -no-undefined \
548 if HAVE_LD_VERSION_SCRIPT
550 libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS += -Wl,--version-script="$(srcdir)/libguile.map"
552 endif HAVE_LD_VERSION_SCRIPT
555 # These are headers visible as <guile/mumble.h>
558 # These are headers visible as <libguile/mumble.h>.
559 modincludedir = $(pkgincludedir)/$(GUILE_EFFECTIVE_VERSION)/libguile
560 modinclude_HEADERS = \
600 generalized-arrays.h \
601 generalized-vectors.h \
683 nodist_modinclude_HEADERS = version.h scmconfig.h
685 bin_SCRIPTS = guile-snarf
687 # We can re-enable install for some of these if/when they are documented
688 # and people feel like maintaining them. For now, this is not the case.
689 noinst_SCRIPTS = guile-snarf-docs
691 EXTRA_DIST = ChangeLog-scm ChangeLog-threads \
692 ChangeLog-1996-1999 ChangeLog-2000 ChangeLog-2008 \
693 guile-func-name-check \
694 cpp-E.syms cpp-E.c cpp-SIG.syms cpp-SIG.c \
696 scmconfig.h.top libgettext.h unidata_to_charset.pl libguile.map \
698 # $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES) \
699 # guile-procedures.txt guile.texi
701 ## FIXME: Consider using timestamp file, to avoid unnecessary rebuilds.
702 libpath.h: $(srcdir)/Makefile.in $(top_builddir)/config.status
704 @echo '/* generated by Makefile */' > libpath.tmp
705 @echo '#define SCM_PKGDATA_DIR "$(pkgdatadir)"' >> libpath.tmp
706 @echo '#define SCM_LIBRARY_DIR "$(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)"'>>libpath.tmp
707 @echo '#define SCM_SITE_DIR "$(sitedir)"' >> libpath.tmp
708 @echo '#define SCM_GLOBAL_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp
709 @echo '#define SCM_LIB_DIR "$(libdir)"' >> libpath.tmp
710 @echo '#define SCM_EXTENSIONS_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions"' >> libpath.tmp
711 @echo '#define SCM_CCACHE_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/ccache"' >> libpath.tmp
712 @echo '#define SCM_SITE_CCACHE_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache"' >> libpath.tmp
713 @echo '#define SCM_EFFECTIVE_VERSION "$(GUILE_EFFECTIVE_VERSION)"' >> libpath.tmp
714 @echo '#define SCM_BUILD_INFO { \' >> libpath.tmp
715 @echo ' { "srcdir", "'"`cd @srcdir@; pwd`"'" }, \' >> libpath.tmp
716 @echo ' { "top_srcdir", "@top_srcdir_absolute@" }, \' >> libpath.tmp
717 @echo ' { "prefix", "@prefix@" }, \' >> libpath.tmp
718 @echo ' { "exec_prefix", "@exec_prefix@" }, \' >> libpath.tmp
719 @echo ' { "bindir", "@bindir@" }, \' >> libpath.tmp
720 @echo ' { "sbindir", "@sbindir@" }, \' >> libpath.tmp
721 @echo ' { "libexecdir", "@libexecdir@" }, \' >> libpath.tmp
722 @echo ' { "datadir", "@datadir@" }, \' >> libpath.tmp
723 @echo ' { "sysconfdir", "@sysconfdir@" }, \' >> libpath.tmp
724 @echo ' { "sharedstatedir", "@sharedstatedir@" }, \' >> libpath.tmp
725 @echo ' { "localstatedir", "@localstatedir@" }, \' >> libpath.tmp
726 @echo ' { "libdir", "@libdir@" }, \' >> libpath.tmp
727 @echo ' { "ccachedir", SCM_CCACHE_DIR }, \' >> libpath.tmp
728 @echo ' { "infodir", "@infodir@" }, \' >> libpath.tmp
729 @echo ' { "mandir", "@mandir@" }, \' >> libpath.tmp
730 @echo ' { "includedir", "@includedir@" }, \' >> libpath.tmp
731 @echo ' { "pkgdatadir", "$(pkgdatadir)" }, \' >> libpath.tmp
732 @echo ' { "pkglibdir", "$(pkglibdir)" }, \' >> libpath.tmp
733 @echo ' { "pkgincludedir", "$(pkgincludedir)" }, \' \
735 @echo ' { "extensiondir", "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions" }, \' >> libpath.tmp
736 @echo ' { "guileversion", "@GUILE_VERSION@" }, \' >> libpath.tmp
737 @echo ' { "libguileinterface", "@LIBGUILE_INTERFACE@" }, \' \
739 @echo ' { "LIBS", "@GUILE_LIBS@" }, \' >> libpath.tmp
740 @echo ' { "CFLAGS", "@GUILE_CFLAGS@" }, \' >> libpath.tmp
741 @echo ' { "buildstamp", "'`date -u +'%Y-%m-%d %T'`'" }, \' >> libpath.tmp
742 @echo '}' >> libpath.tmp
743 $(AM_V_GEN)mv libpath.tmp libpath.h
746 snarfcppopts = $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
751 $(AM_V_SNARF)$(GUILE_SNARF) -o $@ $< $(snarfcppopts)
753 $(AM_V_SNARF)./guile-snarf-docs -o $@ $< -- $(snarfcppopts)
755 $(DOT_X_FILES) $(EXTRA_DOT_X_FILES): scmconfig.h snarf.h guile-snarf.in version.h
757 $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES): scmconfig.h snarf.h guile-snarf-docs.in guile_filter_doc_snarfage$(EXEEXT)
764 alldotdocfiles = $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES)
765 snarf2checkedtexi = GUILE_AUTO_COMPILE=0 $(top_builddir)/meta/uninstalled-env guild snarf-check-and-output-texi
766 dotdoc2texi = cat $(alldotdocfiles) | $(snarf2checkedtexi)
768 guile.texi: $(alldotdocfiles) guile$(EXEEXT)
769 $(dotdoc2texi) --manual > $@ || { rm $@; false; }
771 guile-procedures.texi: $(alldotdocfiles) guile$(EXEEXT)
772 $(AM_V_GEN)$(dotdoc2texi) > $@ || { rm $@; false; }
774 c-tokenize.c: c-tokenize.lex
775 flex -t $(srcdir)/c-tokenize.lex > $@ || { rm $@; false; }
777 ## Add -MG to make the .x magic work with auto-dep code.
778 MKDEP = gcc -M -MG $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
781 # This page is for maintenance of the lists of CPP symbols that are eventually
782 # included in error.c (‘errno’ values: E*) and posix.c (signal names: SIG*),
783 # in the funcs scm_init_{error,posix}, respectively.
785 # The lists (files cpp-{E,SIG}.syms) are not included verbatim, but processed
786 # (via pattern rule ‘.syms.c’ below) so that each CPP symbol is transformed to
787 # fragment of #ifdef'd C code that defines a Scheme variable of the same name.
788 # The resulting files, cpp-{E,SIG}.c, are the ones #include:d.
790 # To maintain the (source) lists of symbols, we use a GCC-specific feature
791 # to list all symbols #define:d when expanding <{errno,signal}.h>, grep
792 # the output for {E,SIG}*, massage the result into a usable form, and
793 # construct a union of the current and new symbols. This is written to
794 # files cpp-{E,SIG}.syms.NEW for review. If things look ok, you can then
795 # "mv foo.NEW foo" and commit. Generating the foo.NEW files and showing
796 # an informative message is the job of targets chknew-{E,SIG}.
798 # For each line in foo.syms, transform:
802 # scm_c_define ("SYMBOL", scm_from_int (SYMBOL));
804 # writing output to foo.c. We use a while-read loop instead of a
805 # one-line sed script because some seds (e.g., FreeBSD) don't read
806 # '\n' as a newline (like GNU sed does). Sad, but true.
809 cat $< | while read sym ; do \
810 echo "#ifdef $$sym" ; \
811 echo "scm_c_define (\"$$sym\", scm_from_int ($$sym));" ; \
816 # Write $(srcdir)/cpp-{E,SIG}.syms.NEW if there are any not-yet-seen
817 # ("new" to us) E* or SIG* symbols in <errno.h> or <signal.h>, respectively.
818 chknew-E chknew-SIG: \
819 @bit=`echo $@ | sed s/^chknew-//` ; \
820 old="$(srcdir)/cpp-$$bit.syms" ; \
821 echo "#include <$${bit}.h>" \
822 | sed 's/E/errno/;s/SIG/signal/' \
824 | sed 's/^#define //;/^'$$bit'[A-Z][A-Z]*/!d;s/ .*//' \
825 | sort | diff -u $$old - | sed '1,2d;/^+/!d;s/^.//' \
827 if [ -s TMP ] ; then new="$$old.NEW" ; \
828 cat $$old TMP | sort > $$new ; \
829 echo "$$new: `sed -n '$$=' TMP` new symbol(s)." ; \
831 else echo "No new symbols found." ; \
837 scmconfig.h scmconfig.h.tmp
839 CLEANFILES = libpath.h *.x *.doc guile-procedures.txt guile-procedures.texi guile.texi
841 MAINTAINERCLEANFILES = c-tokenize.c