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