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