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