start compiling ice-9
[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 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
8 ## it under the terms of the GNU General Public License as
9 ## published by the Free Software Foundation; either version 2, 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 General Public License for more details.
16 ##
17 ## You should have received a copy of the GNU General Public
18 ## License along with GUILE; see the file COPYING. If not, write
19 ## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
20 ## Floor, Boston, MA 02110-1301 USA
21
22 AUTOMAKE_OPTIONS = gnu
23
24 ## Prevent automake from adding extra -I options
25 DEFS = @DEFS@
26 ## Check for headers in $(srcdir)/.., so that #include
27 ## <libguile/MUMBLE.h> will find MUMBLE.h in this dir when we're
28 ## building. Also look for Gnulib headers in `lib'.
29 INCLUDES = -I.. -I$(top_srcdir) \
30 -I$(top_srcdir)/lib -I$(top_builddir)/lib
31
32 ## The Gnulib Libtool archive.
33 gnulib_library = $(top_builddir)/lib/libgnu.la
34
35 ETAGS_ARGS = --regex='/SCM_\(GLOBAL_\)?\(G?PROC\|G?PROC1\|SYMBOL\|VCELL\|CONST_LONG\).*\"\([^\"]\)*\"/\3/' \
36 --regex='/[ \t]*SCM_[G]?DEFINE1?[ \t]*(\([^,]*\),[^,]*/\1/'
37
38 lib_LTLIBRARIES = libguile.la \
39 libguile-i18n-v-@LIBGUILE_I18N_MAJOR@.la
40 bin_PROGRAMS = guile
41
42 noinst_PROGRAMS = guile_filter_doc_snarfage gen-scmconfig
43
44 gen_scmconfig_SOURCES = gen-scmconfig.c
45
46 ## Override default rule; this should be compiled for BUILD host.
47 ## For some reason, OBJEXT does not include the dot
48 gen-scmconfig.$(OBJEXT): gen-scmconfig.c
49 if [ "$(cross_compiling)" = "yes" ]; then \
50 $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ $<; \
51 else \
52 $(COMPILE) -c -o $@ $<; \
53 fi
54
55 ## Override default rule; this should run on BUILD host.
56 gen-scmconfig$(EXEEXT): $(gen_scmconfig_OBJECTS) $(gen_scmconfig_DEPENDENCIES)
57 @rm -f gen-scmconfig$(EXEEXT)
58 if [ "$(cross_compiling)" = "yes" ]; then \
59 $(CCLD_FOR_BUILD) -o $@ $(gen_scmconfig_OBJECTS); \
60 else \
61 $(LINK) $(gen_scmconfig_OBJECTS) $(LDADD) $(LIBS); \
62 fi
63
64 scmconfig.h: ${top_builddir}/config.h gen-scmconfig$(EXEEXT)
65 rm -f scmconfig.h.tmp
66 cat $(srcdir)/scmconfig.h.top > scmconfig.h.tmp
67 ./gen-scmconfig$(EXEEXT) >> scmconfig.h.tmp
68 chmod 444 scmconfig.h.tmp
69 rm -f scmconfig.h
70 mv scmconfig.h.tmp scmconfig.h
71
72 guile_filter_doc_snarfage_SOURCES = c-tokenize.c
73
74 ## Override default rule; this should be compiled for BUILD host.
75 ## For some reason, OBJEXT does not include the dot
76 c-tokenize.$(OBJEXT): c-tokenize.c
77 if [ "$(cross_compiling)" = "yes" ]; then \
78 $(CC_FOR_BUILD) $(DEFS) $(INCLUDES) -c -o $@ $<; \
79 else \
80 $(filter-out -Werror,$(COMPILE)) -c -o $@ $<; \
81 fi
82
83 ## Override default rule; this should run on BUILD host.
84 guile_filter_doc_snarfage$(EXEEXT): $(guile_filter_doc_snarfage_OBJECTS) $(guile_filter_doc_snarfage_DEPENDENCIES)
85 @rm -f guile_filter_doc_snarfage$(EXEEXT)
86 if [ "$(cross_compiling)" = "yes" ]; then \
87 $(CCLD_FOR_BUILD) -o $@ $(guile_filter_doc_snarfage_OBJECTS); \
88 else \
89 $(LINK) $(guile_filter_doc_snarfage_OBJECTS) $(LDADD) $(LIBS); \
90 fi
91
92
93 guile_SOURCES = guile.c
94 guile_CFLAGS = $(GUILE_CFLAGS)
95 guile_LDADD = libguile.la
96 guile_LDFLAGS = @DLPREOPEN@ $(GUILE_CFLAGS)
97
98 libguile_la_CFLAGS = $(GUILE_CFLAGS)
99
100 libguile_la_SOURCES = alist.c arbiters.c async.c backtrace.c boolean.c \
101 chars.c continuations.c convert.c debug.c deprecation.c \
102 deprecated.c discouraged.c dynwind.c eq.c error.c \
103 eval.c evalext.c extensions.c feature.c fluids.c fports.c \
104 futures.c gc.c gc-mark.c gc-segment.c gc-malloc.c gc-card.c \
105 gc-freelist.c gc_os_dep.c gdbint.c gettext.c \
106 gh_data.c gh_eval.c gh_funcs.c \
107 gh_init.c gh_io.c gh_list.c gh_predicates.c goops.c gsubr.c \
108 guardians.c hash.c hashtab.c hooks.c init.c inline.c \
109 ioext.c keywords.c lang.c list.c load.c macros.c mallocs.c \
110 modules.c numbers.c objects.c objprop.c options.c pairs.c ports.c \
111 print.c procprop.c procs.c properties.c random.c rdelim.c read.c \
112 root.c rw.c scmsigs.c script.c simpos.c smob.c sort.c srcprop.c \
113 stackchk.c stacks.c stime.c strings.c srfi-4.c srfi-13.c srfi-14.c \
114 strorder.c strports.c struct.c symbols.c threads.c null-threads.c \
115 throw.c values.c variable.c vectors.c version.c vports.c weaks.c \
116 ramap.c unif.c
117
118 # vm-related sources
119 libguile_la_SOURCES += frames.c instructions.c objcodes.c programs.c vm.c
120
121 libguile_i18n_v_@LIBGUILE_I18N_MAJOR@_la_SOURCES = i18n.c
122 libguile_i18n_v_@LIBGUILE_I18N_MAJOR@_la_CFLAGS = \
123 $(libguile_la_CFLAGS)
124 libguile_i18n_v_@LIBGUILE_I18N_MAJOR@_la_LIBADD = \
125 libguile.la $(gnulib_library)
126 libguile_i18n_v_@LIBGUILE_I18N_MAJOR@_la_LDFLAGS = \
127 -module -L$(builddir) -lguile \
128 -version-info @LIBGUILE_I18N_INTERFACE@
129
130 DOT_X_FILES = alist.x arbiters.x async.x backtrace.x boolean.x chars.x \
131 continuations.x debug.x deprecation.x deprecated.x discouraged.x \
132 dynl.x dynwind.x eq.x error.x eval.x evalext.x \
133 extensions.x feature.x fluids.x fports.x futures.x gc.x gc-mark.x \
134 gc-segment.x gc-malloc.x gc-card.x gettext.x goops.x \
135 gsubr.x guardians.x \
136 hash.x hashtab.x hooks.x i18n.x init.x ioext.x keywords.x lang.x \
137 list.x load.x macros.x mallocs.x modules.x numbers.x objects.x \
138 objprop.x options.x pairs.x ports.x print.x procprop.x procs.x \
139 properties.x random.x rdelim.x read.x root.x rw.x scmsigs.x \
140 script.x simpos.x smob.x sort.x srcprop.x stackchk.x stacks.x \
141 stime.x strings.x srfi-4.x srfi-13.x srfi-14.x strorder.x \
142 strports.x struct.x symbols.x threads.x throw.x values.x \
143 variable.x vectors.x version.x vports.x weaks.x ramap.x unif.x
144
145 # vm-related snarfs
146 DOT_X_FILES += frames.x instructions.x objcodes.x programs.x vm.x
147
148 EXTRA_DOT_X_FILES = @EXTRA_DOT_X_FILES@
149
150 DOT_DOC_FILES = alist.doc arbiters.doc async.doc backtrace.doc \
151 boolean.doc chars.doc continuations.doc debug.doc deprecation.doc \
152 deprecated.doc discouraged.doc dynl.doc dynwind.doc \
153 eq.doc error.doc eval.doc evalext.doc \
154 extensions.doc feature.doc fluids.doc fports.doc futures.doc \
155 gc.doc goops.doc gsubr.doc gc-mark.doc gc-segment.doc \
156 gc-malloc.doc gc-card.doc gettext.doc \
157 guardians.doc hash.doc hashtab.doc \
158 hooks.doc i18n.doc init.doc ioext.doc keywords.doc lang.doc \
159 list.doc load.doc macros.doc mallocs.doc modules.doc numbers.doc \
160 objects.doc objprop.doc options.doc pairs.doc ports.doc print.doc \
161 procprop.doc procs.doc properties.doc random.doc rdelim.doc \
162 read.doc root.doc rw.doc scmsigs.doc script.doc simpos.doc \
163 smob.doc sort.doc srcprop.doc stackchk.doc stacks.doc stime.doc \
164 strings.doc srfi-4.doc srfi-13.doc srfi-14.doc strorder.doc \
165 strports.doc struct.doc symbols.doc threads.doc throw.doc \
166 values.doc variable.doc vectors.doc version.doc vports.doc \
167 weaks.doc ramap.doc unif.doc
168
169 EXTRA_DOT_DOC_FILES = @EXTRA_DOT_DOC_FILES@
170
171 DOT_I_FILES = vm-i-system.i vm-i-scheme.i vm-i-loader.i
172
173 .c.i:
174 grep '^VM_DEFINE' $< > $@
175
176 BUILT_SOURCES = cpp_err_symbols.c cpp_sig_symbols.c libpath.h \
177 version.h scmconfig.h \
178 $(DOT_I_FILES) $(DOT_X_FILES) $(EXTRA_DOT_X_FILES)
179
180 EXTRA_libguile_la_SOURCES = _scm.h \
181 inet_aton.c memmove.c putenv.c strerror.c \
182 dynl.c regex-posix.c \
183 filesys.c posix.c net_db.c socket.c \
184 debug-malloc.c mkstemp.c \
185 win32-uname.c win32-dirent.c win32-socket.c \
186 locale-categories.h
187
188 ## delete guile-snarf.awk from the installation bindir, in case it's
189 ## lingering there due to an earlier guile version not having been
190 ## wiped out.
191 install-exec-hook:
192 rm -f $(DESTDIR)$(bindir)/guile-snarf.awk
193
194 ## This is kind of nasty... there are ".c" files that we don't want to
195 ## compile, since they are #included. So instead we list them here.
196 ## Perhaps we can deal with them normally once the merge seems to be
197 ## working.
198 noinst_HEADERS = convert.i.c \
199 conv-integer.i.c conv-uinteger.i.c \
200 eval.i.c \
201 srfi-4.i.c \
202 quicksort.i.c \
203 win32-uname.h win32-dirent.h win32-socket.h \
204 private-gc.h private-options.h
205
206 # vm instructions
207 noinst_HEADERS += vm-engine.c vm-i-system.c vm-i-scheme.c vm-i-loader.c
208
209 libguile_la_DEPENDENCIES = @LIBLOBJS@
210 libguile_la_LIBADD = @LIBLOBJS@ $(gnulib_library)
211 libguile_la_LDFLAGS = @LTLIBINTL@ -version-info @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@ -export-dynamic -no-undefined
212
213 # These are headers visible as <guile/mumble.h>
214 pkginclude_HEADERS = gh.h
215
216 # These are headers visible as <libguile/mumble.h>.
217 modincludedir = $(includedir)/libguile
218 modinclude_HEADERS = __scm.h alist.h arbiters.h async.h backtrace.h \
219 boolean.h chars.h continuations.h convert.h debug.h debug-malloc.h \
220 deprecation.h deprecated.h discouraged.h dynl.h dynwind.h \
221 eq.h error.h eval.h evalext.h extensions.h \
222 feature.h filesys.h fluids.h fports.h futures.h gc.h \
223 gdb_interface.h gdbint.h gettext.h goops.h \
224 gsubr.h guardians.h hash.h \
225 hashtab.h hooks.h i18n.h init.h inline.h ioext.h iselect.h \
226 keywords.h lang.h list.h load.h macros.h mallocs.h modules.h \
227 net_db.h numbers.h objects.h objprop.h options.h pairs.h ports.h \
228 posix.h regex-posix.h print.h procprop.h procs.h properties.h \
229 random.h ramap.h rdelim.h read.h root.h rw.h scmsigs.h validate.h \
230 script.h simpos.h smob.h snarf.h socket.h sort.h srcprop.h \
231 stackchk.h stacks.h stime.h strings.h srfi-4.h srfi-13.h srfi-14.h \
232 strorder.h strports.h struct.h symbols.h tags.h threads.h \
233 pthread-threads.h null-threads.h throw.h unif.h values.h \
234 variable.h vectors.h vports.h weaks.h
235
236 modinclude_HEADERS += vm-bootstrap.h frames.h instructions.h objcodes.h \
237 programs.h vm.h vm-engine.h vm-expand.h
238
239 nodist_modinclude_HEADERS = version.h scmconfig.h
240
241 bin_SCRIPTS = guile-snarf
242
243 # We can re-enable install for some of these if/when they are documented
244 # and people feel like maintaining them. For now, this is not the case.
245 noinst_SCRIPTS = guile-doc-snarf guile-snarf-docs guile-func-name-check
246
247 EXTRA_DIST = ChangeLog-gh ChangeLog-scm ChangeLog-threads \
248 ChangeLog-1996-1999 ChangeLog-2000 cpp_signal.c \
249 cpp_errno.c cpp_err_symbols.in cpp_err_symbols.c \
250 cpp_sig_symbols.c cpp_sig_symbols.in cpp_cnvt.awk \
251 c-tokenize.lex version.h.in \
252 scmconfig.h.top libgettext.h
253 # $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES) \
254 # guile-procedures.txt guile.texi
255
256 ## We use @-...-@ as the substitution brackets here, instead of the
257 ## usual @...@, so autoconf doesn't go and substitute the values
258 ## directly into the left-hand sides of the sed substitutions. *sigh*
259 version.h: version.h.in
260 sed < $(srcdir)/version.h.in > $@.tmp \
261 -e s:@-GUILE_MAJOR_VERSION-@:${GUILE_MAJOR_VERSION}: \
262 -e s:@-GUILE_MINOR_VERSION-@:${GUILE_MINOR_VERSION}: \
263 -e s:@-GUILE_MICRO_VERSION-@:${GUILE_MICRO_VERSION}:
264 mv $@.tmp $@
265
266 ## FIXME: Consider using timestamp file, to avoid unnecessary rebuilds.
267 libpath.h: $(srcdir)/Makefile.in $(top_builddir)/config.status
268 @echo "Generating libpath.h..."
269 @rm -f libpath.tmp
270 @echo '/* generated by Makefile */' > libpath.tmp
271 @echo '#define SCM_PKGDATA_DIR "$(pkgdatadir)"' >> libpath.tmp
272 @echo '#define SCM_LIBRARY_DIR "$(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)"'>>libpath.tmp
273 @echo '#define SCM_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp
274 @echo '#define SCM_BUILD_INFO { \' >> libpath.tmp
275 @echo ' { "srcdir", "'"`cd @srcdir@; pwd`"'" }, \' >> libpath.tmp
276 @echo ' { "top_srcdir", "@top_srcdir_absolute@" }, \' >> libpath.tmp
277 @echo ' { "prefix", "@prefix@" }, \' >> libpath.tmp
278 @echo ' { "exec_prefix", "@exec_prefix@" }, \' >> libpath.tmp
279 @echo ' { "bindir", "@bindir@" }, \' >> libpath.tmp
280 @echo ' { "sbindir", "@sbindir@" }, \' >> libpath.tmp
281 @echo ' { "libexecdir", "@libexecdir@" }, \' >> libpath.tmp
282 @echo ' { "datadir", "@datadir@" }, \' >> libpath.tmp
283 @echo ' { "sysconfdir", "@sysconfdir@" }, \' >> libpath.tmp
284 @echo ' { "sharedstatedir", "@sharedstatedir@" }, \' >> libpath.tmp
285 @echo ' { "localstatedir", "@localstatedir@" }, \' >> libpath.tmp
286 @echo ' { "libdir", "@libdir@" }, \' >> libpath.tmp
287 @echo ' { "infodir", "@infodir@" }, \' >> libpath.tmp
288 @echo ' { "mandir", "@mandir@" }, \' >> libpath.tmp
289 @echo ' { "includedir", "@includedir@" }, \' >> libpath.tmp
290 @echo ' { "pkgdatadir", "$(datadir)/@PACKAGE@" }, \' >> libpath.tmp
291 @echo ' { "pkglibdir", "$(libdir)/@PACKAGE@" }, \' >> libpath.tmp
292 @echo ' { "pkgincludedir", "$(includedir)/@PACKAGE@" }, \' \
293 >> libpath.tmp
294 @echo ' { "guileversion", "@GUILE_VERSION@" }, \' >> libpath.tmp
295 @echo ' { "libguileinterface", "@LIBGUILE_INTERFACE@" }, \' \
296 >> libpath.tmp
297 @echo ' { "LIBS", "@GUILE_LIBS@" }, \' >> libpath.tmp
298 @echo ' { "CFLAGS", "@GUILE_CFLAGS@" }, \' >> libpath.tmp
299 @echo ' { "buildstamp", "'"`date`"'" }, \' >> libpath.tmp
300 @echo '}' >> libpath.tmp
301 @mv libpath.tmp libpath.h
302
303
304 snarfcppopts = $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
305
306 SUFFIXES = .x .doc
307 .c.x:
308 ./guile-snarf -o $@ $< $(snarfcppopts)
309 .c.doc:
310 -$(AWK) -f ./guile-func-name-check $<
311 (./guile-snarf-docs $(snarfcppopts) $< | \
312 ./guile_filter_doc_snarfage$(EXEEXT) --filter-snarfage) > $@ || { rm $@; false; }
313
314 $(DOT_X_FILES) $(EXTRA_DOT_X_FILES): scmconfig.h snarf.h guile-snarf.in
315
316 $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES): scmconfig.h snarf.h guile-snarf-docs.in guile_filter_doc_snarfage$(EXEEXT)
317
318 error.x: cpp_err_symbols.c
319 posix.x: cpp_sig_symbols.c
320 load.x: libpath.h
321
322 include $(top_srcdir)/am/pre-inst-guile
323
324 alldotdocfiles = $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES)
325 snarf2checkedtexi = GUILE="$(GUILE_FOR_BUILD)" $(top_srcdir)/scripts/snarf-check-and-output-texi
326 dotdoc2texi = cat $(alldotdocfiles) | $(snarf2checkedtexi)
327
328 guile.texi: $(alldotdocfiles) guile$(EXEEXT)
329 $(dotdoc2texi) --manual > $@ || { rm $@; false; }
330
331 guile-procedures.texi: $(alldotdocfiles) guile$(EXEEXT)
332 $(dotdoc2texi) > $@ || { rm $@; false; }
333
334 if HAVE_MAKEINFO
335
336 guile-procedures.txt: guile-procedures.texi
337 rm -f $@
338 makeinfo --force -o $@ guile-procedures.texi || test -f $@
339
340 else
341
342 guile-procedures.txt: guile-procedures.texi
343 cp guile-procedures.texi $@
344
345 endif
346
347 c-tokenize.c: c-tokenize.lex
348 flex -t $(srcdir)/c-tokenize.lex > $@ || { rm $@; false; }
349
350 schemelibdir = $(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)
351 schemelib_DATA = guile-procedures.txt
352
353 ## Add -MG to make the .x magic work with auto-dep code.
354 MKDEP = gcc -M -MG $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
355
356 cpp_err_symbols.c: cpp_err_symbols.in cpp_cnvt.awk
357 $(AWK) -f $(srcdir)/cpp_cnvt.awk < $(srcdir)/cpp_err_symbols.in > \
358 cpp_err_symbols.tmp
359 mv cpp_err_symbols.tmp cpp_err_symbols.c
360
361 cpp_sig_symbols.c: cpp_sig_symbols.in cpp_cnvt.awk
362 $(AWK) -f $(srcdir)/cpp_cnvt.awk < $(srcdir)/cpp_sig_symbols.in > \
363 cpp_sig_symbols.tmp
364 mv cpp_sig_symbols.tmp cpp_sig_symbols.c
365
366 ## Create a new version of the cpp_sig_symbols.in file, including all SIGXXX
367 ## macros defined on this platform.
368 check_signals:
369 gcc -undef -dM -E $(srcdir)/cpp_signal.c | egrep ' SIG[A-Z]+' \
370 | cut -f2 -d' ' | sort > cpp_sig_symbols_here
371 diff -u $(srcdir)/cpp_sig_symbols.in cpp_sig_symbols_here \
372 | egrep '^\+S' \
373 | cut -c2- > cpp_sig_symbols_diff
374 if test -s cpp_sig_symbols_diff ; then \
375 cat $(srcdir)/cpp_sig_symbols.in cpp_sig_symbols_diff \
376 | sort > cpp_sig_symbols_new ;\
377 echo "cpp_sig_symbols_new has the following additions:" ;\
378 cat cpp_sig_symbols_diff ;\
379 else echo "No new symbols found."; \
380 fi
381
382 ## Likewise for cpp_err_symbols.in.
383 check_errnos:
384 gcc -undef -dM -E $(srcdir)/cpp_errno.c | egrep ' E.+' \
385 | cut -f2 -d' ' | sort > cpp_err_symbols_here
386 diff -u $(srcdir)/cpp_err_symbols.in cpp_err_symbols_here \
387 | egrep '^\+E' \
388 | cut -c2- > cpp_err_symbols_diff
389 if test -s cpp_err_symbols_diff ; then \
390 cat $(srcdir)/cpp_err_symbols.in cpp_err_symbols_diff \
391 | sort > cpp_err_symbols_new ;\
392 echo "cpp_err_symbols_new has the following additions:" ;\
393 cat cpp_err_symbols_diff ;\
394 else echo "No new symbols found."; \
395 fi
396
397 MOSTLYCLEANFILES = \
398 cpp_err_symbols_here cpp_err_symbols_diff cpp_err_symbols_new \
399 cpp_sig_symbols_here cpp_sig_symbols_diff cpp_sig_symbols_new \
400 version.h version.h.tmp \
401 scmconfig.h scmconfig.h.tmp
402
403 CLEANFILES = libpath.h *.x *.doc guile-procedures.txt guile-procedures.texi guile.texi
404
405 MAINTAINERCLEANFILES = c-tokenize.c