1include libtool-version.mk 2include $(top_builddir)/libgcroots.mk 3include $(top_builddir)/sigscheme.mk 4 5if USE_LIBSSCM 6lib_LTLIBRARIES = libsscm.la 7endif 8 9SCRIPT_DIR = $(top_srcdir)/tools 10BUILD_FUNCTBL = $(SCRIPT_DIR)/build_func_table.rb 11BUILD_FUNCTBL_CMD = $(RUBY) -I$(top_srcdir)/tools $(BUILD_FUNCTBL) 12BUILD_FUNCTBL_DEPS = \ 13 $(BUILD_FUNCTBL) \ 14 $(SCRIPT_DIR)/scm_decl.rb \ 15 $(SCRIPT_DIR)/functable-header.txt \ 16 $(SCRIPT_DIR)/functable-footer.txt 17 18FUNC_TABLES = \ 19 functable-sscm-core.c \ 20 functable-r5rs-core.c \ 21 functable-r5rs-syntax.c \ 22 functable-r5rs-qquote.c \ 23 functable-r5rs-macro.c \ 24 functable-r5rs-promise.c \ 25 functable-r5rs-number.c \ 26 functable-r5rs-number-io.c \ 27 functable-r5rs-char.c \ 28 functable-r5rs-string.c \ 29 functable-r5rs-string-procedure.c \ 30 functable-r5rs-vector.c \ 31 functable-r5rs-port.c \ 32 functable-r5rs-read.c \ 33 functable-r5rs-write.c \ 34 functable-r5rs-load.c \ 35 functable-r5rs-deep-cadrs.c \ 36 functable-legacy-macro.c \ 37 functable-sscm-ext.c \ 38 functable-siod.c \ 39 functable-srfi1.c \ 40 functable-srfi2.c \ 41 functable-srfi6.c \ 42 functable-srfi8.c \ 43 functable-srfi9.c \ 44 functable-srfi23.c \ 45 functable-srfi28.c \ 46 functable-srfi34.c \ 47 functable-srfi38.c \ 48 functable-srfi43.c \ 49 functable-srfi48.c \ 50 functable-srfi55.c \ 51 functable-srfi60.c 52 53if MAINTAINER_MODE 54$(FUNC_TABLES): $(top_builddir)/config.status 55# Core 56SSCM_CORE_SRCS = \ 57 $(srcdir)/error.c \ 58 $(srcdir)/module.c 59R5RS_CORE_SRCS = \ 60 $(srcdir)/eval.c \ 61 $(srcdir)/list.c \ 62 $(srcdir)/procedure.c 63functable-sscm-core.c: $(SSCM_CORE_SRCS) $(BUILD_FUNCTBL_DEPS) 64 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_sscm_core" $(SSCM_CORE_SRCS) 65functable-r5rs-core.c: $(R5RS_CORE_SRCS) $(BUILD_FUNCTBL_DEPS) 66 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_core" $(R5RS_CORE_SRCS) 67# R5RS syntaxes 68functable-r5rs-syntax.c: $(srcdir)/syntax.c $(BUILD_FUNCTBL_DEPS) 69 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_syntax" $< 70functable-r5rs-qquote.c: $(srcdir)/qquote.c $(BUILD_FUNCTBL_DEPS) 71 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_qquote" $< 72functable-r5rs-macro.c: $(srcdir)/macro.c $(BUILD_FUNCTBL_DEPS) 73 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_macro" $< 74functable-r5rs-promise.c: $(srcdir)/promise.c $(BUILD_FUNCTBL_DEPS) 75 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_promise" $< 76# R5RS procedures 77functable-r5rs-number.c: $(srcdir)/number.c $(BUILD_FUNCTBL_DEPS) 78 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_number" $< 79functable-r5rs-number-io.c: $(srcdir)/number-io.c $(BUILD_FUNCTBL_DEPS) 80 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_number_io" $< 81functable-r5rs-char.c: $(srcdir)/char.c $(BUILD_FUNCTBL_DEPS) 82 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_char" $< 83functable-r5rs-string.c: $(srcdir)/string.c $(BUILD_FUNCTBL_DEPS) 84 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_string" $< 85functable-r5rs-string-procedure.c: $(srcdir)/string-procedure.c $(BUILD_FUNCTBL_DEPS) 86 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_string_procedure" $< 87functable-r5rs-vector.c: $(srcdir)/vector.c $(BUILD_FUNCTBL_DEPS) 88 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_vector" $< 89functable-r5rs-port.c: $(srcdir)/port.c $(BUILD_FUNCTBL_DEPS) 90 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_port" $< 91functable-r5rs-read.c: $(srcdir)/read.c $(BUILD_FUNCTBL_DEPS) 92 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_read" $< 93functable-r5rs-write.c: $(srcdir)/write.c $(BUILD_FUNCTBL_DEPS) 94 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_write" $< 95functable-r5rs-load.c: $(srcdir)/load.c $(BUILD_FUNCTBL_DEPS) 96 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_load" $< 97functable-r5rs-deep-cadrs.c: $(srcdir)/deep-cadrs.c $(BUILD_FUNCTBL_DEPS) 98 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_r5rs_deep_cadrs" $< 99# Optional modules 100functable-legacy-macro.c: $(srcdir)/legacy-macro.c $(BUILD_FUNCTBL_DEPS) 101 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_legacy_macro" $< 102functable-sscm-ext.c: $(srcdir)/module-sscm-ext.c $(BUILD_FUNCTBL_DEPS) 103 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_sscm_ext" $< 104functable-siod.c: $(srcdir)/module-siod.c $(BUILD_FUNCTBL_DEPS) 105 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_siod" $< 106functable-srfi1.c: $(srcdir)/module-srfi1.c $(BUILD_FUNCTBL_DEPS) 107 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi1" $< 108functable-srfi2.c: $(srcdir)/module-srfi2.c $(BUILD_FUNCTBL_DEPS) 109 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi2" $< 110functable-srfi6.c: $(srcdir)/module-srfi6.c $(BUILD_FUNCTBL_DEPS) 111 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi6" $< 112functable-srfi8.c: $(srcdir)/module-srfi8.c $(BUILD_FUNCTBL_DEPS) 113 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi8" $< 114functable-srfi9.c: $(srcdir)/module-srfi9.c $(BUILD_FUNCTBL_DEPS) 115 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi9" $< 116functable-srfi23.c: $(srcdir)/module-srfi23.c $(BUILD_FUNCTBL_DEPS) 117 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi23" $< 118functable-srfi28.c: $(srcdir)/module-srfi28.c $(BUILD_FUNCTBL_DEPS) 119 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi28" $< 120functable-srfi34.c: $(srcdir)/module-srfi34.c $(BUILD_FUNCTBL_DEPS) 121 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi34" $< 122functable-srfi38.c: $(srcdir)/module-srfi38.c $(BUILD_FUNCTBL_DEPS) 123 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi38" $< 124functable-srfi43.c: $(srcdir)/module-srfi43.c $(BUILD_FUNCTBL_DEPS) 125 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi43" $< 126functable-srfi48.c: $(srcdir)/module-srfi48.c $(BUILD_FUNCTBL_DEPS) 127 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi48" $< 128functable-srfi55.c: $(srcdir)/module-srfi55.c $(BUILD_FUNCTBL_DEPS) 129 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi55" $< 130functable-srfi60.c: $(srcdir)/module-srfi60.c $(BUILD_FUNCTBL_DEPS) 131 $(BUILD_FUNCTBL_CMD) $@ "scm_functable_srfi60" $< 132endif 133 134# Optional and not built by 'make all'. Build explicitly with 'make combined' 135# if needed. This target does not use non-standard scripting languages for 136# portability. 137sigscheme-combined.c: $(libsscm_sources) config.h 138 @echo 'generating $@' 139 @echo "/* This is an auto-generated file. Don't edit directly. */" >$@ 140 @echo >>$@ 141 @echo '#include "sigscheme-combined.h"' >>$@ 142 @echo >>$@ 143 @for src in $^ $>; do \ 144 case $$src in \ 145 *.c) \ 146 printf '#include "' >>$@; \ 147 printf $$src >>$@; \ 148 printf '"\n' >>$@; \ 149 ;; \ 150 esac \ 151 done 152 @echo >>$@ 153 @echo '#include "sigscheme-combined-trim.h"' >>$@ 154 @echo >>$@ 155 @echo '#if SCM_USE_AGGREGATED_GLOBAL_VARS' >>$@ 156 @echo 'SCM_AGGREGATED_GLOBAL_VARS_BEGIN;' >>$@ 157 @for src in $^ $>; do \ 158 case $$src in \ 159 global.h) ;; \ 160 *.h | *.c) \ 161 $(EGREP) -e '^ *SCM_DEFINE_(STATIC|EXPORTED)_VARS\b' $$src \ 162 | sed -e 's/^.*SCM_DEFINE_STATIC_VARS/ SCM_AGGREGATED_GLOBAL_VARS/' \ 163 -e 's/^.*SCM_DEFINE_EXPORTED_VARS/ SCM_AGGREGATED_GLOBAL_VARS/' >>$@; \ 164 ;; \ 165 esac \ 166 done 167 @echo 'SCM_AGGREGATED_GLOBAL_VARS_END;' >>$@ 168 @echo >>$@ 169 @echo '#include "global-aggregated.c"' >>$@ 170 @echo >>$@ 171 @for src in $^ $>; do \ 172 case $$src in \ 173 global.h) ;; \ 174 *.h | *.c) \ 175 $(EGREP) -e '^ *SCM_DEFINE_(STATIC|EXPORTED)_VARS\b' $$src \ 176 | sed -e 's/^.*SCM_DEFINE_STATIC_VARS/SCM_DEFINE_GLOBAL_VARS_INSTANCE_ACCESSOR/' \ 177 -e 's/^.*SCM_DEFINE_EXPORTED_VARS/SCM_DEFINE_GLOBAL_VARS_INSTANCE_ACCESSOR/' >>$@; \ 178 ;; \ 179 esac \ 180 done 181 @echo '#endif /* SCM_USE_AGGREGATED_GLOBAL_VARS */' >>$@ 182 183if MAINTAINER_MODE 184# Internal macros trimmer for combined-source version of SigScheme. 185# All source files are processed regardless of user configuration. 186sigscheme-combined-trim.h: $(DIST_SOURCES) 187 @test -n "$(PERL)" || (echo 'perl(1) not found: install Perl'; exit 1) 188 @echo 'generating $@' 189 @echo "/* This is an auto-generated file. Don't edit directly. */" >$@ 190 @for src in $^ $>; do \ 191 case $$src in \ 192 config-old.h) ;; \ 193 scmint.h) ;; \ 194 encoding.h) ;; \ 195 encoding-dummy.h) ;; \ 196 encoding-config.h) ;; \ 197 scmport.h) ;; \ 198 scmport-config.h) ;; \ 199 scmport-null.h) ;; \ 200 scmport-file.h) ;; \ 201 scmport-str.h) ;; \ 202 scmport-sbchar.h) ;; \ 203 scmport-mbchar.h) ;; \ 204 storage-*.h) ;; \ 205 sigscheme.h) ;; \ 206 main.c) ;; \ 207 *.h | *.c) \ 208 echo >>$@; \ 209 $(PERL) -ne 'BEGIN { print "/* $$ARGV[0] */\n"; } if (s/^\s*#define\s+(\w+).*$$/#undef \1/) { print if (!$$macros{$$1} && $$1 !~ /^__\w+_H$$/); $$macros{$$1} = true; }' $$src >>$@; \ 210 ;; \ 211 esac \ 212 done 213endif 214 215BUILT_DIST = $(FUNC_TABLES) sigscheme-combined-trim.h 216 217# Since no target of sigscheme directory uses sigscheme-combined.h as source, 218# the file is not listed into *_HEADERS. 219EXTRA_DIST = \ 220 $(BUILT_DIST) $(BUILD_FUNCTBL_DEPS) \ 221 sigscheme-combined.h global-aggregated.c template.h template.c 222 223# FIXME: Build dll on supported platforms 224EXTRA_DIST += dllentry.c 225 226# Only works on 'make all', 'make check' and 'make install'. 227# See "Built sources" section of automake info. 228BUILT_SOURCES = $(BUILT_DIST) 229 230# Suppress installing headers on combined-source configuration 231if USE_LIBSSCM 232nodist_pkginclude_HEADERS = config.h 233pkginclude_HEADERS = config-old.h scmint.h global.h sigscheme.h 234endif 235 236libsscm_sources = \ 237 alloc.c storage.c storage-gc.c \ 238 error.c symbol.c env.c eval.c \ 239 syntax.c procedure.c list.c \ 240 sigschemeinternal.h module.c sigscheme.c 241if USE_LIBSSCM 242if USE_STORAGE_COMPACT 243 pkginclude_HEADERS += storage-common.h storage-compact.h 244else 245 pkginclude_HEADERS += storage-common.h storage-fatty.h 246endif 247endif 248if USE_CONTINUATION 249 libsscm_sources += continuation.c 250endif 251if USE_PORT 252 libsscm_sources += \ 253 scmport.h scmport-config.h \ 254 scmport-file.h scmport-file.c \ 255 scmport-basechar.c 256if USE_MULTIBYTE_CHAR 257if USE_LIBSSCM 258 pkginclude_HEADERS += encoding.h 259endif 260 libsscm_sources += encoding-config.h encoding.c \ 261 scmport-mbchar.h scmport-mbchar.c 262else 263if USE_LIBSSCM 264 pkginclude_HEADERS += encoding-dummy.h 265endif 266 libsscm_sources += scmport-sbchar.h scmport-sbchar.c 267endif 268endif 269if USE_FORMAT 270 libsscm_sources += format.c 271endif 272if USE_QUASIQUOTE 273 libsscm_sources += qquote.c 274endif 275# FIXME: support SCM_USE_SYNTAX_CASE 276if USE_HYGIENIC_MACRO 277 libsscm_sources += macro.c 278endif 279if USE_LEGACY_MACRO 280 libsscm_sources += legacy-macro.c 281endif 282if USE_PROMISE 283 libsscm_sources += promise.c 284endif 285if USE_NUMBER 286 libsscm_sources += number.c 287endif 288if USE_NUMBER_IO 289 libsscm_sources += number-io.c 290endif 291if USE_CHAR 292 libsscm_sources += char.c 293endif 294if USE_STRING 295 libsscm_sources += string.c 296endif 297if USE_STRING_PROCEDURE 298 libsscm_sources += string-procedure.c 299endif 300if USE_VECTOR 301 libsscm_sources += vector.c 302endif 303if USE_PORT 304 libsscm_sources += port.c 305endif 306if USE_READER 307 libsscm_sources += read.c 308endif 309if USE_WRITER 310 libsscm_sources += write.c 311endif 312if USE_LOAD 313 libsscm_sources += load.c 314endif 315if USE_DEEP_CADRS 316 libsscm_sources += deep-cadrs.c 317endif 318 319# optional modules 320if USE_SSCM_EXTENSIONS 321 libsscm_sources += module-sscm-ext.c 322endif 323if COMPAT_SIOD 324 libsscm_sources += module-siod.c scmport-null.h scmport-null.c 325endif 326if USE_SRFI1 327 libsscm_sources += module-srfi1.c 328endif 329if USE_SRFI2 330 libsscm_sources += module-srfi2.c 331endif 332if USE_SRFI6 333 libsscm_sources += module-srfi6.c scmport-str.h scmport-str.c 334endif 335if USE_SRFI8 336 libsscm_sources += module-srfi8.c 337endif 338if USE_SRFI9 339 libsscm_sources += module-srfi9.c 340endif 341if USE_SRFI23 342 libsscm_sources += module-srfi23.c 343endif 344if USE_SRFI28 345 libsscm_sources += module-srfi28.c 346endif 347if USE_SRFI34 348 libsscm_sources += module-srfi34.c 349endif 350if USE_SRFI38 351 libsscm_sources += module-srfi38.c 352endif 353if USE_SRFI43 354 libsscm_sources += module-srfi43.c 355endif 356if USE_SRFI48 357 libsscm_sources += module-srfi48.c 358endif 359if USE_SRFI55 360 libsscm_sources += module-srfi55.c 361endif 362if USE_SRFI60 363 libsscm_sources += module-srfi60.c 364endif 365 366if USE_LIBGCROOTS_TINY_SUBST 367libsscm_sources += gcroots/gcroots.h gcroots/gcroots.c 368endif 369 370if USE_LIBSSCM 371libsscm_la_SOURCES = $(libsscm_sources) 372libsscm_la_LIBADD = $(LIBOBJS) @GCROOTS_LIBS@ 373libsscm_la_LDFLAGS = -version-info $(libsscm_version) 374# To take precedence over installed gcroots.h by the bundled 375# libgcroots/include/gcroots.h, @GCROOTS_CFLAGS@ must be placed here. 376libsscm_la_CPPFLAGS = -I$(top_builddir)/include @GCROOTS_CFLAGS@ \ 377 -DSCM_COMPILING_LIBSSCM=1 378libsscm_la_CFLAGS = 379endif 380 381if USE_SHELL 382bin_PROGRAMS = sscm 383sscm_SOURCES = main.c 384sscm_LDADD = libsscm.la @GCROOTS_LIBS@ 385sscm_CPPFLAGS = -I$(top_builddir)/include @GCROOTS_CFLAGS@ 386sscm_CFLAGS = 387endif 388 389# To enable ruby-and-perl-less build on tarball distribution, we should not 390# delete $(FUNC_TABLES) and sigscheme-combined-trim.h here. 391CLEANFILES = sigscheme-combined.c 392DISTCLEANFILES = 393MAINTAINERCLEANFILES = $(BUILT_DIST) 394 395ETAGS_ARGS = sigschemeinternal.h 396 397.PHONY: lib combined func-tables clean-func-tables clean-built 398lib: libsscm.la 399combined: sigscheme-combined-trim.h sigscheme-combined.c 400clean-combined: 401 rm -f sigscheme-combined-trim.h sigscheme-combined.c 402func-tables: $(FUNC_TABLES) 403clean-func-tables: 404 rm -f $(FUNC_TABLES) 405 406dist-hook: 407 @test -n "$(RUBY)" || (echo 'ruby(1) not found: install Ruby'; exit 1) 408 @test -n "$(PERL)" || (echo 'perl(1) not found: install Perl'; exit 1) 409