New foreign object facility, to replace SMOBs
[bpt/guile.git] / libguile / Makefile.am
1 ## Process this file with Automake to create Makefile.in
2 ##
3 ## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007,
4 ## 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
5 ##
6 ## This file is part of GUILE.
7 ##
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.
12 ##
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.
17 ##
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
22
23 include $(top_srcdir)/am/snarf
24
25 AUTOMAKE_OPTIONS = gnu
26
27 ## Prevent automake from adding extra -I options
28 DEFS = @DEFS@
29
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>.
33 DEFAULT_INCLUDES =
34
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)
40
41 AM_CFLAGS = $(GCC_CFLAGS) $(CFLAG_VISIBILITY)
42
43 ## The Gnulib Libtool archive.
44 gnulib_library = $(top_builddir)/lib/libgnu.la
45
46 ETAGS_ARGS = --regex='/SCM_\(GLOBAL_\)?\(G?PROC\|G?PROC1\|SYMBOL\|VCELL\|CONST_LONG\).*\"\([^\"]\)*\"/\3/' \
47 --regex='/[ \t]*SCM_[G]?DEFINE1?[ \t]*(\([^,]*\),[^,]*/\1/'
48
49 lib_LTLIBRARIES = libguile-@GUILE_EFFECTIVE_VERSION@.la
50 bin_PROGRAMS = guile
51
52 noinst_PROGRAMS = guile_filter_doc_snarfage gen-scmconfig
53
54 gen_scmconfig_SOURCES = gen-scmconfig.c
55
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
63 $(AM_V_GEN) \
64 if [ "$(cross_compiling)" = "yes" ]; then \
65 $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) -I$(top_builddir) \
66 -c -o $@ $<; \
67 else \
68 $(COMPILE) -c -o $@ $<; \
69 fi
70
71 ## Override default rule; this should run on BUILD host.
72 gen-scmconfig$(EXEEXT): $(gen_scmconfig_OBJECTS) $(gen_scmconfig_DEPENDENCIES)
73 $(AM_V_GEN) \
74 rm -f gen-scmconfig$(EXEEXT); \
75 if [ "$(cross_compiling)" = "yes" ]; then \
76 $(CCLD_FOR_BUILD) -o $@ $(gen_scmconfig_OBJECTS); \
77 else \
78 $(LINK) $(gen_scmconfig_OBJECTS) $(LDADD) $(LIBS); \
79 fi
80
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; \
86 rm -f scmconfig.h; \
87 mv scmconfig.h.tmp scmconfig.h)
88
89
90 guile_filter_doc_snarfage_SOURCES = c-tokenize.c
91
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
95 $(AM_V_GEN) \
96 if [ "$(cross_compiling)" = "yes" ]; then \
97 $(CC_FOR_BUILD) -DCROSS_COMPILING=1 -I$(top_builddir) \
98 -c -o "$@" "$<"; \
99 else \
100 $(COMPILE) -c -o "$@" "$<"; \
101 fi
102
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)
105 $(AM_V_GEN) \
106 rm -f guile_filter_doc_snarfage$(EXEEXT); \
107 if [ "$(cross_compiling)" = "yes" ]; then \
108 $(CCLD_FOR_BUILD) -o $@ $(guile_filter_doc_snarfage_OBJECTS); \
109 else \
110 $(LINK) $(guile_filter_doc_snarfage_OBJECTS) $(LDADD) $(gnulib_library) $(LIBS); \
111 fi
112
113
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)
118
119 libguile_@GUILE_EFFECTIVE_VERSION@_la_CFLAGS = $(GUILE_CFLAGS) $(AM_CFLAGS)
120
121 libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES = \
122 alist.c \
123 arbiters.c \
124 array-handle.c \
125 array-map.c \
126 arrays.c \
127 async.c \
128 backtrace.c \
129 boolean.c \
130 bitvectors.c \
131 bytevectors.c \
132 chars.c \
133 control.c \
134 continuations.c \
135 debug.c \
136 deprecated.c \
137 deprecation.c \
138 dynwind.c \
139 eq.c \
140 error.c \
141 eval.c \
142 evalext.c \
143 expand.c \
144 extensions.c \
145 feature.c \
146 filesys.c \
147 finalizers.c \
148 fluids.c \
149 foreign.c \
150 foreign-object.c \
151 fports.c \
152 frames.c \
153 gc-malloc.c \
154 gc.c \
155 gdbint.c \
156 gettext.c \
157 generalized-arrays.c \
158 generalized-vectors.c \
159 goops.c \
160 gsubr.c \
161 guardians.c \
162 hash.c \
163 hashtab.c \
164 hooks.c \
165 i18n.c \
166 init.c \
167 inline.c \
168 instructions.c \
169 ioext.c \
170 keywords.c \
171 list.c \
172 load.c \
173 macros.c \
174 mallocs.c \
175 memoize.c \
176 modules.c \
177 null-threads.c \
178 numbers.c \
179 objcodes.c \
180 objprop.c \
181 options.c \
182 pairs.c \
183 poll.c \
184 ports.c \
185 print.c \
186 procprop.c \
187 procs.c \
188 programs.c \
189 promises.c \
190 r6rs-ports.c \
191 random.c \
192 rdelim.c \
193 read.c \
194 root.c \
195 rw.c \
196 scmsigs.c \
197 script.c \
198 simpos.c \
199 smob.c \
200 sort.c \
201 srcprop.c \
202 srfi-1.c \
203 srfi-4.c \
204 srfi-13.c \
205 srfi-14.c \
206 srfi-60.c \
207 stackchk.c \
208 stacks.c \
209 stime.c \
210 strings.c \
211 strorder.c \
212 strports.c \
213 struct.c \
214 symbols.c \
215 threads.c \
216 throw.c \
217 trees.c \
218 uniform.c \
219 values.c \
220 variable.c \
221 vectors.c \
222 version.c \
223 vm.c \
224 vports.c \
225 weaks.c
226
227 DOT_X_FILES = \
228 alist.x \
229 arbiters.x \
230 array-handle.x \
231 array-map.x \
232 arrays.x \
233 async.x \
234 backtrace.x \
235 boolean.x \
236 bitvectors.x \
237 bytevectors.x \
238 chars.x \
239 control.x \
240 continuations.x \
241 debug.x \
242 deprecated.x \
243 deprecation.x \
244 dynl.x \
245 dynwind.x \
246 eq.x \
247 error.x \
248 eval.x \
249 evalext.x \
250 expand.x \
251 extensions.x \
252 feature.x \
253 filesys.x \
254 fluids.x \
255 foreign.x \
256 fports.x \
257 gc-malloc.x \
258 gc.x \
259 gettext.x \
260 generalized-arrays.x \
261 generalized-vectors.x \
262 goops.x \
263 gsubr.x \
264 guardians.x \
265 hash.x \
266 hashtab.x \
267 hooks.x \
268 i18n.x \
269 init.x \
270 ioext.x \
271 keywords.x \
272 list.x \
273 load.x \
274 macros.x \
275 mallocs.x \
276 memoize.x \
277 modules.x \
278 numbers.x \
279 objprop.x \
280 options.x \
281 pairs.x \
282 ports.x \
283 print.x \
284 procprop.x \
285 procs.x \
286 promises.x \
287 r6rs-ports.x \
288 random.x \
289 rdelim.x \
290 read.x \
291 root.x \
292 rw.x \
293 scmsigs.x \
294 script.x \
295 simpos.x \
296 smob.x \
297 sort.x \
298 srcprop.x \
299 srfi-1.x \
300 srfi-4.x \
301 srfi-13.x \
302 srfi-14.x \
303 srfi-60.x \
304 stackchk.x \
305 stacks.x \
306 stime.x \
307 strings.x \
308 strorder.x \
309 strports.x \
310 struct.x \
311 symbols.x \
312 threads.x \
313 throw.x \
314 trees.x \
315 uniform.x \
316 values.x \
317 variable.x \
318 vectors.x \
319 version.x \
320 vports.x \
321 weaks.x
322
323 # vm-related snarfs
324 DOT_X_FILES += frames.x instructions.x objcodes.x programs.x vm.x
325
326 EXTRA_DOT_X_FILES = @EXTRA_DOT_X_FILES@
327
328 DOT_DOC_FILES = \
329 alist.doc \
330 arbiters.doc \
331 array-handle.doc \
332 array-map.doc \
333 arrays.doc \
334 async.doc \
335 backtrace.doc \
336 boolean.doc \
337 bitvectors.doc \
338 bytevectors.doc \
339 chars.doc \
340 control.doc \
341 continuations.doc \
342 debug.doc \
343 deprecated.doc \
344 deprecation.doc \
345 dynl.doc \
346 dynwind.doc \
347 eq.doc \
348 error.doc \
349 eval.doc \
350 evalext.doc \
351 expand.doc \
352 extensions.doc \
353 feature.doc \
354 filesys.doc \
355 fluids.doc \
356 foreign.doc \
357 fports.doc \
358 gc-malloc.doc \
359 gc.doc \
360 gettext.doc \
361 generalized-arrays.doc \
362 generalized-vectors.doc \
363 goops.doc \
364 gsubr.doc \
365 guardians.doc \
366 hash.doc \
367 hashtab.doc \
368 hooks.doc \
369 i18n.doc \
370 init.doc \
371 ioext.doc \
372 keywords.doc \
373 list.doc \
374 load.doc \
375 macros.doc \
376 mallocs.doc \
377 memoize.doc \
378 modules.doc \
379 numbers.doc \
380 objprop.doc \
381 options.doc \
382 pairs.doc \
383 ports.doc \
384 print.doc \
385 procprop.doc \
386 procs.doc \
387 promises.doc \
388 r6rs-ports.doc \
389 random.doc \
390 rdelim.doc \
391 read.doc \
392 root.doc \
393 rw.doc \
394 scmsigs.doc \
395 script.doc \
396 simpos.doc \
397 smob.doc \
398 sort.doc \
399 srcprop.doc \
400 srfi-1.doc \
401 srfi-4.doc \
402 srfi-13.doc \
403 srfi-14.doc \
404 srfi-60.doc \
405 stackchk.doc \
406 stacks.doc \
407 stime.doc \
408 strings.doc \
409 strorder.doc \
410 strports.doc \
411 struct.doc \
412 symbols.doc \
413 threads.doc \
414 throw.doc \
415 trees.doc \
416 uniform.doc \
417 values.doc \
418 variable.doc \
419 vectors.doc \
420 version.doc \
421 vports.doc \
422 weaks.doc
423
424 EXTRA_DOT_DOC_FILES = @EXTRA_DOT_DOC_FILES@
425
426 DOT_I_FILES = vm-i-system.i vm-i-scheme.i vm-i-loader.i
427
428 .c.i:
429 $(AM_V_GEN)$(GREP) '^VM_DEFINE' $< > $@
430
431 BUILT_SOURCES = cpp-E.c cpp-SIG.c libpath.h \
432 scmconfig.h \
433 $(DOT_I_FILES) $(DOT_X_FILES) $(EXTRA_DOT_X_FILES)
434
435 # Force the generation of `guile-procedures.texi' because the top-level
436 # Makefile expects it to be built.
437 all-local: guile-procedures.texi
438
439 EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES = _scm.h \
440 memmove.c strerror.c \
441 dynl.c regex-posix.c \
442 posix.c net_db.c socket.c \
443 debug-malloc.c mkstemp.c \
444 win32-uname.c \
445 locale-categories.h
446
447 ## delete guile-snarf.awk from the installation bindir, in case it's
448 ## lingering there due to an earlier guile version not having been
449 ## wiped out.
450 install-exec-hook:
451 rm -f $(DESTDIR)$(bindir)/guile-snarf.awk
452
453 install-data-hook: libguile-2.0-gdb.scm
454 @$(MKDIR_P) $(DESTDIR)$(libdir)
455 ## We want to install libguile-2.0-gdb.scm as SOMETHING-gdb.scm.
456 ## SOMETHING is the full name of the final library. We want to ignore
457 ## symlinks, the .la file, and any previous -gdb.py file. This is
458 ## inherently fragile, but there does not seem to be a better option,
459 ## because libtool hides the real names from us. (Trick courtesy of
460 ## GNU libstdc++.)
461 @here=`pwd`; cd $(DESTDIR)$(libdir); \
462 for file in libguile-@GUILE_EFFECTIVE_VERSION@*; do \
463 case $$file in \
464 *-gdb.scm) ;; \
465 *.la) ;; \
466 *) if test -h $$file; then \
467 continue; \
468 fi; \
469 libname=$$file;; \
470 esac; \
471 done; \
472 cd $$here; \
473 echo " $(INSTALL_DATA) $< \
474 $(DESTDIR)$(libdir)/$$libname-gdb.scm"; \
475 $(INSTALL_DATA) "$<" \
476 "$(DESTDIR)$(libdir)/$$libname-gdb.scm"
477
478 # Remove the GDB support file and the Info 'dir' file that
479 # 'install-info' 5.x installs.
480 uninstall-hook:
481 -rm "$(DESTDIR)$(libdir)/libguile-@GUILE_EFFECTIVE_VERSION@"*-gdb.scm
482 -rm -f "$(DESTDIR)$(infodir)/dir"
483
484 ## This is kind of nasty... there are ".c" files that we don't want to
485 ## compile, since they are #included. So instead we list them here.
486 ## Perhaps we can deal with them normally once the merge seems to be
487 ## working.
488 noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c \
489 srfi-14.i.c \
490 quicksort.i.c \
491 win32-uname.h \
492 private-gc.h private-options.h ports-internal.h
493
494 # vm instructions
495 noinst_HEADERS += vm-engine.c vm-i-system.c vm-i-scheme.c vm-i-loader.c
496
497 libguile_@GUILE_EFFECTIVE_VERSION@_la_DEPENDENCIES = @LIBLOBJS@
498
499 libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD = \
500 @LIBLOBJS@ $(gnulib_library) $(LTLIBGMP) $(LTLIBLTDL)
501
502 # Libtool version info.
503 version_info = @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@
504
505 libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS = \
506 $(BDW_GC_LIBS) $(LIBFFI_LIBS) \
507 $(CEIL_LIBM) \
508 $(FLOOR_LIBM) \
509 $(FREXP_LIBM) \
510 $(GETADDRINFO_LIB) \
511 $(HOSTENT_LIB) \
512 $(INET_NTOP_LIB) \
513 $(INET_PTON_LIB) \
514 $(ISNAND_LIBM) \
515 $(ISNANF_LIBM) \
516 $(ISNANL_LIBM) \
517 $(LDEXP_LIBM) \
518 $(LIBSOCKET) \
519 $(LIB_CLOCK_GETTIME) \
520 $(LOG1P_LIBM) \
521 $(LOG_LIBM) \
522 $(LTLIBICONV) \
523 $(LTLIBINTL) \
524 $(LTLIBUNISTRING) \
525 $(ROUND_LIBM) \
526 $(SERVENT_LIB) \
527 $(TRUNC_LIBM) \
528 -version-info $(version_info) \
529 -export-dynamic -no-undefined \
530 $(GNU_LD_FLAGS)
531
532 if HAVE_LD_VERSION_SCRIPT
533
534 libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS += -Wl,--version-script="$(srcdir)/libguile.map"
535
536 endif HAVE_LD_VERSION_SCRIPT
537
538
539 # These are headers visible as <guile/mumble.h>
540 pkginclude_HEADERS =
541
542 # These are headers visible as <libguile/mumble.h>.
543 modincludedir = $(pkgincludedir)/$(GUILE_EFFECTIVE_VERSION)/libguile
544 modinclude_HEADERS = \
545 __scm.h \
546 alist.h \
547 arbiters.h \
548 array-handle.h \
549 array-map.h \
550 arrays.h \
551 async.h \
552 backtrace.h \
553 bdw-gc.h \
554 boolean.h \
555 bitvectors.h \
556 bytevectors.h \
557 chars.h \
558 control.h \
559 continuations.h \
560 debug-malloc.h \
561 debug.h \
562 deprecated.h \
563 deprecation.h \
564 dynl.h \
565 dynwind.h \
566 eq.h \
567 error.h \
568 eval.h \
569 evalext.h \
570 expand.h \
571 extensions.h \
572 feature.h \
573 finalizers.h \
574 filesys.h \
575 fluids.h \
576 foreign.h \
577 foreign-object.h \
578 fports.h \
579 frames.h \
580 gc.h \
581 gdb_interface.h \
582 gdbint.h \
583 gettext.h \
584 generalized-arrays.h \
585 generalized-vectors.h \
586 goops.h \
587 gsubr.h \
588 guardians.h \
589 hash.h \
590 hashtab.h \
591 hooks.h \
592 i18n.h \
593 init.h \
594 inline.h \
595 instructions.h \
596 ioext.h \
597 iselect.h \
598 keywords.h \
599 list.h \
600 load.h \
601 macros.h \
602 mallocs.h \
603 memoize.h \
604 modules.h \
605 net_db.h \
606 null-threads.h \
607 numbers.h \
608 objcodes.h \
609 objprop.h \
610 options.h \
611 pairs.h \
612 poll.h \
613 ports.h \
614 posix.h \
615 print.h \
616 procprop.h \
617 procs.h \
618 programs.h \
619 promises.h \
620 pthread-threads.h \
621 r6rs-ports.h \
622 random.h \
623 rdelim.h \
624 read.h \
625 regex-posix.h \
626 root.h \
627 rw.h \
628 scmsigs.h \
629 script.h \
630 simpos.h \
631 smob.h \
632 snarf.h \
633 socket.h \
634 sort.h \
635 srcprop.h \
636 srfi-1.h \
637 srfi-4.h \
638 srfi-13.h \
639 srfi-14.h \
640 srfi-60.h \
641 stackchk.h \
642 stacks.h \
643 stime.h \
644 strings.h \
645 strorder.h \
646 strports.h \
647 struct.h \
648 symbols.h \
649 tags.h \
650 threads.h \
651 throw.h \
652 trees.h \
653 validate.h \
654 uniform.h \
655 values.h \
656 variable.h \
657 vectors.h \
658 vm-engine.h \
659 vm-expand.h \
660 vm.h \
661 vports.h \
662 weaks.h
663
664 nodist_modinclude_HEADERS = version.h scmconfig.h
665
666 bin_SCRIPTS = guile-snarf
667
668 # We can re-enable install for some of these if/when they are documented
669 # and people feel like maintaining them. For now, this is not the case.
670 noinst_SCRIPTS = guile-snarf-docs
671
672 EXTRA_DIST = ChangeLog-scm ChangeLog-threads \
673 ChangeLog-1996-1999 ChangeLog-2000 ChangeLog-2008 \
674 guile-func-name-check \
675 cpp-E.syms cpp-E.c cpp-SIG.syms cpp-SIG.c \
676 c-tokenize.lex \
677 scmconfig.h.top libgettext.h unidata_to_charset.pl libguile.map \
678 libguile-2.0-gdb.scm
679 # $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES) \
680 # guile-procedures.txt guile.texi
681
682 ## FIXME: Consider using timestamp file, to avoid unnecessary rebuilds.
683 libpath.h: $(srcdir)/Makefile.in $(top_builddir)/config.status
684 @rm -f libpath.tmp
685 @echo '/* generated by Makefile */' > libpath.tmp
686 @echo '#define SCM_PKGDATA_DIR "$(pkgdatadir)"' >> libpath.tmp
687 @echo '#define SCM_LIBRARY_DIR "$(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)"'>>libpath.tmp
688 @echo '#define SCM_SITE_DIR "$(sitedir)"' >> libpath.tmp
689 @echo '#define SCM_GLOBAL_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp
690 @echo '#define SCM_LIB_DIR "$(libdir)"' >> libpath.tmp
691 @echo '#define SCM_EXTENSIONS_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions"' >> libpath.tmp
692 @echo '#define SCM_CCACHE_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/ccache"' >> libpath.tmp
693 @echo '#define SCM_SITE_CCACHE_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache"' >> libpath.tmp
694 @echo '#define SCM_EFFECTIVE_VERSION "$(GUILE_EFFECTIVE_VERSION)"' >> libpath.tmp
695 @echo '#define SCM_BUILD_INFO { \' >> libpath.tmp
696 @echo ' { "srcdir", "'"`cd @srcdir@; pwd`"'" }, \' >> libpath.tmp
697 @echo ' { "top_srcdir", "@top_srcdir_absolute@" }, \' >> libpath.tmp
698 @echo ' { "prefix", "@prefix@" }, \' >> libpath.tmp
699 @echo ' { "exec_prefix", "@exec_prefix@" }, \' >> libpath.tmp
700 @echo ' { "bindir", "@bindir@" }, \' >> libpath.tmp
701 @echo ' { "sbindir", "@sbindir@" }, \' >> libpath.tmp
702 @echo ' { "libexecdir", "@libexecdir@" }, \' >> libpath.tmp
703 @echo ' { "datadir", "@datadir@" }, \' >> libpath.tmp
704 @echo ' { "sysconfdir", "@sysconfdir@" }, \' >> libpath.tmp
705 @echo ' { "sharedstatedir", "@sharedstatedir@" }, \' >> libpath.tmp
706 @echo ' { "localstatedir", "@localstatedir@" }, \' >> libpath.tmp
707 @echo ' { "libdir", "@libdir@" }, \' >> libpath.tmp
708 @echo ' { "ccachedir", SCM_CCACHE_DIR }, \' >> libpath.tmp
709 @echo ' { "infodir", "@infodir@" }, \' >> libpath.tmp
710 @echo ' { "mandir", "@mandir@" }, \' >> libpath.tmp
711 @echo ' { "includedir", "@includedir@" }, \' >> libpath.tmp
712 @echo ' { "pkgdatadir", "$(pkgdatadir)" }, \' >> libpath.tmp
713 @echo ' { "pkglibdir", "$(pkglibdir)" }, \' >> libpath.tmp
714 @echo ' { "pkgincludedir", "$(pkgincludedir)" }, \' \
715 >> libpath.tmp
716 @echo ' { "extensiondir", "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions" }, \' >> libpath.tmp
717 @echo ' { "guileversion", "@GUILE_VERSION@" }, \' >> libpath.tmp
718 @echo ' { "libguileinterface", "@LIBGUILE_INTERFACE@" }, \' \
719 >> libpath.tmp
720 @echo ' { "LIBS", "@GUILE_LIBS@" }, \' >> libpath.tmp
721 @echo ' { "CFLAGS", "@GUILE_CFLAGS@" }, \' >> libpath.tmp
722 @echo ' { "buildstamp", "'`date -u +'%Y-%m-%d %T'`'" }, \' >> libpath.tmp
723 @echo '}' >> libpath.tmp
724 $(AM_V_GEN)mv libpath.tmp libpath.h
725
726
727 snarfcppopts = $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
728
729 SUFFIXES = .x .doc
730
731 .c.x:
732 $(AM_V_SNARF)$(GUILE_SNARF) -o $@ $< $(snarfcppopts)
733 .c.doc:
734 $(AM_V_SNARF)./guile-snarf-docs -o $@ $< -- $(snarfcppopts)
735
736 $(DOT_X_FILES) $(EXTRA_DOT_X_FILES): scmconfig.h snarf.h guile-snarf.in version.h
737
738 $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES): scmconfig.h snarf.h guile-snarf-docs.in guile_filter_doc_snarfage$(EXEEXT)
739
740 error.x: cpp-E.c
741 posix.x: cpp-SIG.c
742 load.x: libpath.h
743 dynl.x: libpath.h
744
745 alldotdocfiles = $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES)
746 snarf2checkedtexi = GUILE_INSTALL_LOCALE=1 GUILE_AUTO_COMPILE=0 \
747 $(top_builddir)/meta/uninstalled-env guild snarf-check-and-output-texi
748 dotdoc2texi = cat $(alldotdocfiles) | $(snarf2checkedtexi)
749
750 guile.texi: $(alldotdocfiles) guile$(EXEEXT)
751 $(dotdoc2texi) --manual > $@ || { rm $@; false; }
752
753 guile-procedures.texi: $(alldotdocfiles) guile$(EXEEXT)
754 $(AM_V_GEN)$(dotdoc2texi) > $@ || { rm $@; false; }
755
756 c-tokenize.c: c-tokenize.lex
757 flex -t $(srcdir)/c-tokenize.lex > $@ || { rm $@; false; }
758
759 ## Add -MG to make the .x magic work with auto-dep code.
760 MKDEP = gcc -M -MG $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
761
762 \f
763 # This page is for maintenance of the lists of CPP symbols that are eventually
764 # included in error.c (‘errno’ values: E*) and posix.c (signal names: SIG*),
765 # in the funcs scm_init_{error,posix}, respectively.
766 #
767 # The lists (files cpp-{E,SIG}.syms) are not included verbatim, but processed
768 # (via pattern rule ‘.syms.c’ below) so that each CPP symbol is transformed to
769 # fragment of #ifdef'd C code that defines a Scheme variable of the same name.
770 # The resulting files, cpp-{E,SIG}.c, are the ones #include:d.
771 #
772 # To maintain the (source) lists of symbols, we use a GCC-specific feature
773 # to list all symbols #define:d when expanding <{errno,signal}.h>, grep
774 # the output for {E,SIG}*, massage the result into a usable form, and
775 # construct a union of the current and new symbols. This is written to
776 # files cpp-{E,SIG}.syms.NEW for review. If things look ok, you can then
777 # "mv foo.NEW foo" and commit. Generating the foo.NEW files and showing
778 # an informative message is the job of targets chknew-{E,SIG}.
779
780 # For each line in foo.syms, transform:
781 # SYMBOL
782 # to:
783 # #ifdef SYMBOL
784 # scm_c_define ("SYMBOL", scm_from_int (SYMBOL));
785 # #endif
786 # writing output to foo.c. We use a while-read loop instead of a
787 # one-line sed script because some seds (e.g., FreeBSD) don't read
788 # '\n' as a newline (like GNU sed does). Sad, but true.
789 .syms.c:
790 $(AM_V_GEN) \
791 cat $< | while read sym ; do \
792 echo "#ifdef $$sym" ; \
793 echo "scm_c_define (\"$$sym\", scm_from_int ($$sym));" ; \
794 echo "#endif" ; \
795 done > $@T
796 @mv $@T $@
797
798 # Write $(srcdir)/cpp-{E,SIG}.syms.NEW if there are any not-yet-seen
799 # ("new" to us) E* or SIG* symbols in <errno.h> or <signal.h>, respectively.
800 chknew-E chknew-SIG: \
801 @bit=`echo $@ | sed s/^chknew-//` ; \
802 old="$(srcdir)/cpp-$$bit.syms" ; \
803 echo "#include <$${bit}.h>" \
804 | sed 's/E/errno/;s/SIG/signal/' \
805 | gcc -dM -E - \
806 | sed 's/^#define //;/^'$$bit'[A-Z][A-Z]*/!d;s/ .*//' \
807 | sort | diff -u $$old - | sed '1,2d;/^+/!d;s/^.//' \
808 > TMP ; \
809 if [ -s TMP ] ; then new="$$old.NEW" ; \
810 cat $$old TMP | sort > $$new ; \
811 echo "$$new: `sed -n '$$=' TMP` new symbol(s)." ; \
812 sed 's/^/ /' TMP ; \
813 else echo "No new symbols found." ; \
814 fi ; rm TMP
815
816 \f
817
818 MOSTLYCLEANFILES = \
819 scmconfig.h scmconfig.h.tmp
820
821 CLEANFILES = libpath.h *.x *.doc guile-procedures.txt guile-procedures.texi guile.texi \
822 vm-i-*.i
823
824 MAINTAINERCLEANFILES = c-tokenize.c