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