mechanism for configuring the C back end.
dnl Process this file with autoconf to produce a configure script.
AC_INIT([MIT/GNU Scheme microcode], [14.18], [bug-mit-scheme@gnu.org], [mit-scheme])
-AC_REVISION([$Id: configure.ac,v 1.27 2007/01/12 02:22:06 cph Exp $])
+AC_REVISION([$Id: configure.ac,v 1.28 2007/01/12 02:57:10 cph Exp $])
AC_CONFIG_SRCDIR([boot.c])
AC_CONFIG_HEADERS([config.h])
AC_PROG_MAKE_SET
MODULE_RULES=/dev/null
MODULE_CFLAGS="-DCOMPILE_AS_MODULE"
MODULE_LDFLAGS=
-COMPILED_SOURCES=
-COMPILED_OBJECTS=
-CBE_RULES=/dev/null
+LIARC_RULES_1=/dev/null
+LIARC_RULES_2=/dev/null
dnl Checks for programs.
AC_PROG_CC
AC_DEFINE([COMPILE_FOR_STATIC_LINKING], [1],
[Define to 1 for static compilation of C native code.])
OPTIONAL_BASES="${OPTIONAL_BASES} cmpauxmd unstackify compinit"
- COMPILED_SOURCES="utabmd.c"
- for D in runtime sf cref star-parser compiler; do
- COMPILED_SOURCES="${COMPILED_SOURCES} \$(wildcard ../${D}/*.c)"
- done
- for D in back base fggen fgopt machines/C rtlbase rtlgen rtlopt; do
- COMPILED_SOURCES="${COMPILED_SOURCES} \$(wildcard ../compiler/${D}/*.c)"
- done
- CBE_RULES=makegen/cbe-rules
+ LIARC_RULES_1=liarc-rules-1
+ LIARC_RULES_2=makegen/liarc-rules-2
;;
*)
AC_MSG_RESULT([yes, for ${SCM_ARCH}])
AC_SUBST_FILE([MODULE_RULES])
AC_SUBST([MODULE_CFLAGS])
AC_SUBST([MODULE_LDFLAGS])
-AC_SUBST([COMPILED_SOURCES])
-AC_SUBST([COMPILED_OBJECTS])
-AC_SUBST_FILE([CBE_RULES])
+AC_SUBST_FILE([LIARC_RULES_1])
+AC_SUBST_FILE([LIARC_RULES_2])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
--- /dev/null
+#include "liarc.h"
# -*- Makefile -*-
#
-# $Id: Makefile.in.in,v 1.40 2007/01/12 02:16:47 cph Exp $
+# $Id: Makefile.in.in,v 1.41 2007/01/12 02:57:10 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# **** END BOILERPLATE ****
-# **** C back end stuff (I) ****
-COMPILED_SOURCES = @COMPILED_SOURCES@
-COMPILED_OBJECTS = $(COMPILED_SOURCES:.c=.o)
-
# **** Tool configuration ****
AUXDIR = $(libdir)/mit-scheme
TAR = tar
GZIP_ENV = --best
-DEFS = -DMIT_SCHEME -DDEFAULT_LIBRARY_PATH=\"$(AUXDIR)\" @DEFS@ \
- @SCHEME_DEFS@ -I. -I$(srcdir) -I.
+DEFS = @DEFS@ @SCHEME_DEFS@ -DMIT_SCHEME -DDEFAULT_LIBRARY_PATH=\"$(AUXDIR)\"
CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@ -I. -I$(srcdir)
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
M4_FLAGS = @M4_FLAGS@
COMPILE = $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@
+LINK = $(CCLD) $(LDFLAGS) -o $@
EXPAND = $(M4) $(M4_FLAGS)
ASSEMBLE = $(AS) $(AS_FLAGS)
-# **** Configured files ****
+# **** File configuration ****
+
+SHARED_SOURCES = @(write-sources "files-core")@ \
+ @(write-sources "files-os-prim")@ \
+ @(write-sources "files-unix")@ \
+ $(OPTIONAL_SOURCES)
+SHARED_OBJECTS = @(write-objects "files-core")@ \
+ @(write-objects "files-os-prim")@ \
+ @(write-objects "files-unix")@ \
+ $(OPTIONAL_OBJECTS)
+
+STD_SOURCES = $(SHARED_SOURCES) @(write-sources "files-gc-std")@
+STD_OBJECTS = $(SHARED_OBJECTS) @(write-objects "files-gc-std")@
+
+BCH_SOURCES = $(SHARED_SOURCES) @(write-sources "files-gc-bch")@
+BCH_OBJECTS = $(SHARED_OBJECTS) @(write-objects "files-gc-bch")@
GC_HEAD_FILES = @GC_HEAD_FILES@
-OPTIONAL_SOURCES = @OPTIONAL_SOURCES@ $(COMPILED_SOURCES)
-OPTIONAL_OBJECTS = @OPTIONAL_OBJECTS@ $(COMPILED_OBJECTS)
+OPTIONAL_SOURCES = @OPTIONAL_SOURCES@
+OPTIONAL_OBJECTS = @OPTIONAL_OBJECTS@
STATIC_LIBS = @STATIC_PREFIX@ @STATIC_LIBS@ @STATIC_SUFFIX@
PRBFISH_LIBS = @PRBFISH_LIBS@
PRMD5_LIBS = @PRMD5_LIBS@
LINK_MODULE = $(LINK) $(MODULE_LDFLAGS)
MODULE_LIBS = -lc
-# **** Non-configured files ****
+# **** Rules for C back end (part 1) ****
-CORE_SOURCES = @(write-sources "files-core")@
-OS_PRIM_SOURCES = @(write-sources "files-os-prim")@
-UNIX_SOURCES = @(write-sources "files-unix")@
-STD_GC_SOURCES = @(write-sources "files-gc-std")@
-BCH_GC_SOURCES = @(write-sources "files-gc-bch")@
-
-CORE_OBJECTS = @(write-objects "files-core")@
-OS_PRIM_OBJECTS = @(write-objects "files-os-prim")@
-UNIX_OBJECTS = @(write-objects "files-unix")@
-STD_GC_OBJECTS = @(write-objects "files-gc-std")@
-BCH_GC_OBJECTS = @(write-objects "files-gc-bch")@
-
-SHARED_SOURCES = $(CORE_SOURCES) $(OS_PRIM_SOURCES) $(UNIX_SOURCES) \
- $(OPTIONAL_SOURCES)
-
-SHARED_OBJECTS = $(CORE_OBJECTS) $(OS_PRIM_OBJECTS) $(UNIX_OBJECTS) \
- $(OPTIONAL_OBJECTS)
+@LIARC_RULES_1@
# **** Program definitions ****
aux_DATA = utabmd.bin
EXTRA_PROGRAMS = findprim bintopsb psbtobin
-scheme_SOURCES = $(SHARED_SOURCES) $(STD_GC_SOURCES) usrdef.c
-scheme_OBJECTS = $(SHARED_OBJECTS) $(STD_GC_OBJECTS) usrdef.o
+scheme_SOURCES = $(STD_SOURCES) usrdef.c $(LIARC_SOURCES)
+scheme_OBJECTS = $(STD_OBJECTS) usrdef.o $(LIARC_OBJECTS)
scheme_DEPENDENCIES =
scheme_LDFLAGS = @DLD_LDFLAGS@
scheme_LIBS = $(STATIC_LIBS) $(LIBS)
-bchscheme_SOURCES = $(SHARED_SOURCES) $(BCH_GC_SOURCES) bchdef.c
-bchscheme_OBJECTS = $(SHARED_OBJECTS) $(BCH_GC_OBJECTS) bchdef.o
+bchscheme_SOURCES = $(BCH_SOURCES) bchdef.c $(LIARC_SOURCES)
+bchscheme_OBJECTS = $(BCH_OBJECTS) bchdef.o $(LIARC_OBJECTS)
bchscheme_DEPENDENCIES =
bchscheme_LDFLAGS = @DLD_LDFLAGS@
bchscheme_LIBS = $(STATIC_LIBS) $(LIBS)
ALL_LIBS = $(aux_LIBS)
ALL_DATA = $(aux_DATA)
-MOSTLYCLEAN_FILES = *.o cmpauxmd.s usrdef.c bchdef.c \
- compinit.h utabmd.c utabmd.bci *.tch
+MOSTLYCLEAN_FILES = *.o cmpauxmd.s usrdef.c compinit.h utabmd.c utabmd.bci \
+ bchdef.c
CLEAN_FILES = $(ALL_PROGRAMS) $(ALL_LIBS) $(ALL_DATA) $(EXTRA_PROGRAMS)
DISTCLEAN_FILES = Makefile config.h config.cache config.log config.status \
- cmpauxmd.m4 cmpauxmd.c cmpintmd.h TAGS makegen-cc
+ cmpauxmd.m4 cmpauxmd.c cmpintmd.h makegen-cc
-MAINTAINER_CLEAN_FILES = Makefile.in Makefile.deps config.h.in configure
+MAINTAINER_CLEAN_FILES = Makefile.in Makefile.deps liarc-rules-1 \
+ config.h.in configure TAGS
# **** Implicit rules ****
-rm -f $@
$(LINK) $(scheme_LDFLAGS) $(scheme_OBJECTS) $(scheme_LIBS)
-usrdef.c: $(SHARED_SOURCES) $(STD_GC_SOURCES) findprim Makefile
+usrdef.c: $(STD_SOURCES) findprim Makefile
-rm -f $@
- ./findprim $(SHARED_SOURCES) $(STD_GC_SOURCES) > usrdef.c
+ ./findprim $(STD_SOURCES) > usrdef.c
bchscheme: $(bchscheme_OBJECTS) $(bchscheme_DEPENDENCIES)
-rm -f $@
$(LINK) $(bchscheme_LDFLAGS) $(bchscheme_OBJECTS) $(bchscheme_LIBS)
-bchdef.c: $(SHARED_SOURCES) $(BCH_GC_SOURCES) findprim Makefile
+bchdef.c: $(BCH_SOURCES) findprim Makefile
-rm -f $@
- ./findprim $(SHARED_SOURCES) $(BCH_GC_SOURCES) > bchdef.c
+ ./findprim $(BCH_SOURCES) > bchdef.c
gcdrone: $(bchdrn_OBJECTS) $(bchdrn_DEPENDENCIES)
-rm -f $@
tags: TAGS
TAGS:
- etags -r '/^DEF[A-Za-z_ \t(]+"\([^"]+\)"/' *.[ch]
+ etags -r '/^DEF[A-Z0-9_]*[ \t]*(\("[^"]+"\|[a-zA-Z_][a-zA-Z0-9_]*\)/' \
+ *.[ch] */*.[ch]
mostlyclean:
-rm -f $(MOSTLYCLEAN_FILES)
@list='$(bin_PROGRAMS)'; \
for p in $$list; do \
if test -f $$p; then \
- echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/."; \
+ echo "$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/."; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/.; \
fi; \
done
@list='$(aux_PROGRAMS)'; \
for p in $$list; do \
if test -f $$p; then \
- echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(AUXDIR)/."; \
+ echo "$(INSTALL_PROGRAM) $$p $(DESTDIR)$(AUXDIR)/."; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(AUXDIR)/.; \
fi; \
done
@list='$(aux_LIBS)'; \
for p in $$list; do \
if test -f $$p; then \
- echo " $(INSTALL_DATA) $$p $(DESTDIR)$(AUXDIR)/lib/."; \
+ echo "$(INSTALL_DATA) $$p $(DESTDIR)$(AUXDIR)/lib/."; \
$(INSTALL_DATA) $$p $(DESTDIR)$(AUXDIR)/lib/.; \
fi; \
done
@list='$(aux_DATA)'; \
for p in $$list; do \
if test -f $$p; then \
- echo " $(INSTALL_DATA) $$p $(DESTDIR)$(AUXDIR)/."; \
+ echo "$(INSTALL_DATA) $$p $(DESTDIR)$(AUXDIR)/."; \
$(INSTALL_DATA) $$p $(DESTDIR)$(AUXDIR)/.; \
fi; \
done
@(write-dependencies)@
-@CBE_RULES@
+# **** Rules for C back end (part 2) ****
+
+@LIARC_RULES_2@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
+++ /dev/null
-# -*- Makefile -*-
-#
-# $Id: cbe-rules,v 1.2 2007/01/08 14:55:22 cph Exp $
-#
-# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007 Massachusetts Institute of Technology
-#
-# This file is part of MIT/GNU Scheme.
-#
-# MIT/GNU Scheme is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# MIT/GNU Scheme is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with MIT/GNU Scheme; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# **** C back end rules ****
-
-cmpauxmd.o: cmpauxmd.c liarc.tch prims.h bignum.h bitstr.h avltree.h \
- outf.h extern.h
-
-compinit.o: compinit.c compinit.h liarc.tch
-
-unstackify.o: unstackify.c stackops.h liarc.tch
-
-LIARC_HEAD_FILES = \
-ansidecl.h \
-config.h \
-dstack.h \
-default.h \
-object.h \
-sdata.h \
-types.h \
-errors.h \
-const.h \
-interp.h \
-prim.h \
-trap.h \
-outf.h \
-extern.h \
-$(GC_HEAD_FILES)
-
-# The following includes liarc.tch in case COMPILED_SOURCES is empty,
-# to prevent grep from reading stdin.
-
-compinit.h: $(COMPILED_SOURCES) liarc.tch Makefile
- rm -f $@
- grep \^DECLARE_COMPILED_CODE liarc.tch $(COMPILED_SOURCES) \
- | sed -e 's/.*:/ /' > $@
- grep \^DECLARE_COMPILED_DATA liarc.tch $(COMPILED_SOURCES) \
- | sed -e 's/.*:/ /' >> $@
- grep \^DECLARE_DATA_OBJECT liarc.tch $(COMPILED_SOURCES) \
- | sed -e 's/.*:/ /' >> $@
-
-foo $(COMPILED_OBJECTS): liarc.tch
-liarc.tch: liarc.h $(LIARC_HEAD_FILES)
- rm -f $@
- echo "touch" > $@
-
-# **** End C back end rules ***
--- /dev/null
+#| -*-Scheme-*-
+
+$Id: dirs-liarc.scm,v 1.2 2007/01/12 02:57:10 cph Exp $
+
+Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+ 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2006, 2007 Massachusetts Institute of Technology
+
+This file is part of MIT/GNU Scheme.
+
+MIT/GNU Scheme is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+MIT/GNU Scheme is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with MIT/GNU Scheme; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+USA.
+
+|#
+
+;;;; Directories holding statically-linked C files.
+
+;;; Format is a list with the directory in the car and a list of
+;;; exclusions in the cdr.
+
+("../runtime")
+("../sf")
+("../cref")
+("../compiler")
+("../compiler/back")
+("../compiler/base")
+("../compiler/fggen")
+("../compiler/fgopt")
+("../compiler/machines/C")
+("../compiler/rtlbase")
+("../compiler/rtlgen")
+("../compiler/rtlopt")
+("../star-parser" "compile" "ed-ffi" "load" "test-parser")
--- /dev/null
+# -*- Makefile -*-
+#
+# $Id: liarc-rules-2,v 1.2 2007/01/12 02:57:10 cph Exp $
+#
+# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007 Massachusetts Institute of Technology
+#
+# This file is part of MIT/GNU Scheme.
+#
+# MIT/GNU Scheme is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# MIT/GNU Scheme is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with MIT/GNU Scheme; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# Makefile rules for C back end
+
+$(LIARC_OBJECTS): $(LIARC_HEAD_FILES)
+cmpauxmd.o: cmpauxmd.c $(LIARC_HEAD_FILES) prims.h bignum.h bitstr.h avltree.h
+compinit.o: compinit.c compinit.h $(LIARC_HEAD_FILES)
+unstackify.o: unstackify.c stackops.h $(LIARC_HEAD_FILES)
+
+compinit.h: $(LIARC_SOURCES) Makefile
+ rm -f $@
+ ./make-compinit $(LIARC_SOURCES) > $@
#| -*-Scheme-*-
-$Id: makegen.scm,v 1.14 2007/01/05 21:19:26 cph Exp $
+$Id: makegen.scm,v 1.15 2007/01/12 02:57:10 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(load-option 'REGULAR-EXPRESSION)
(load-option 'SYNCHRONOUS-SUBPROCESS)
\f
-(define (generate-makefile template deps-filename makefile)
+(define (generate-makefile)
(let ((file-lists
(map (lambda (pathname)
(cons (pathname-name pathname)
(read-file pathname)))
- (list-transform-positive (directory-read "makegen/")
+ (keep-matching-items (directory-read "makegen/")
(lambda (pathname)
(re-string-match "^files-.+\\.scm$"
(file-namestring pathname)))))))
- (call-with-input-file template
+ (call-with-input-file "makegen/Makefile.in.in"
(lambda (input)
- (call-with-output-file makefile
+ (call-with-output-file "Makefile.in"
(lambda (output)
- (write-string "# This file automatically generated from " output)
- (write-string (file-namestring template) output)
- (newline output)
- (write-string "# on " output)
- (write-string (universal-time->string (get-universal-time)) output)
- (write-string "." output)
- (newline output)
- (newline output)
+ (write-header output)
(let loop ((column 0))
(let ((char (read-char input)))
(if (not (eof-object? char))
(if (eqv? #\@ (peek-char input))
(read-char input)
(error "Missing @ at end of command:" command))
- (loop (interpret-command command column
- file-lists deps-filename
+ (loop (interpret-command command column file-lists
output)))
(begin
(write-char char output)
(loop
(if (char=? #\newline char)
0
- (+ column 1))))))))))))))
-
-(define (interpret-command command column file-lists deps-filename output)
+ (+ column 1)))))))))))))
+ (call-with-output-file "liarc-rules-1"
+ (lambda (output)
+ (write-header output)
+ (write-rule "LIARC_HEAD_FILES"
+ "="
+ (cddr (generate-rule "liarc-gendeps.c"))
+ output)
+ (newline output)
+ (newline output)
+ (let ((files
+ (cons "utabmd"
+ (enumerate-directories
+ (read-file "makegen/dirs-liarc.scm")))))
+ (write-rule "LIARC_SOURCES" "=" (files+suffix files ".c") output)
+ (newline output)
+ (newline output)
+ (write-rule "LIARC_OBJECTS" "=" (files+suffix files ".o") output)
+ (newline output)))))
+
+(define (write-header output)
+ (write-string "# This file automatically generated at " output)
+ (write-string (universal-time->local-iso8601-string (get-universal-time))
+ output)
+ (write-string "." output)
+ (newline output)
+ (newline output))
+\f
+(define (interpret-command command column file-lists output)
(let ((malformed (lambda () (error "Malformed command:" command))))
(if (not (and (pair? command)
(symbol? (car command))
(lambda (n)
(if (not (= n (length (cdr command))))
(malformed)))))
- (let ((map-over-entries
- (lambda (procedure)
+ (let ((write-suffixed
+ (lambda (suffix)
(guarantee-nargs 1)
(let ((entry (assoc (cadr command) file-lists)))
(if (not entry)
(malformed))
- (write-items (map procedure (cdr entry))
+ (write-items (files+suffix (cdr entry) suffix)
column
- output)
- 0))))
- (case (car command)
- ((WRITE-SOURCES)
- (map-over-entries (lambda (entry) (string-append entry ".c"))))
- ((WRITE-OBJECTS)
- (map-over-entries (lambda (entry) (string-append entry ".o"))))
- ((WRITE-DEPENDENCIES)
- (guarantee-nargs 0)
- (write-dependencies file-lists deps-filename output))
- (else
- (error "Unknown command:" command)))))))
+ output)))))
+ (case (car command)
+ ((WRITE-SOURCES)
+ (write-suffixed ".c"))
+ ((WRITE-OBJECTS)
+ (write-suffixed ".o"))
+ ((WRITE-DEPENDENCIES)
+ (guarantee-nargs 0)
+ (write-dependencies file-lists "Makefile.deps" output))
+ (else
+ (error "Unknown command:" command)))))))
+
+(define (enumerate-directories specs)
+ (map (lambda (path)
+ (enough-namestring (pathname-new-type path #f)))
+ (append-map (lambda (spec)
+ (let ((dir (pathname-as-directory (car spec))))
+ (if (file-directory? dir)
+ (delete-matching-items
+ (directory-read (merge-pathnames "*.scm" dir))
+ (lambda (path)
+ (member (pathname-name path) (cdr spec))))
+ (begin
+ (warn "Can't read directory:" dir)
+ '()))))
+ specs)))
+
+(define (files+suffix files suffix)
+ (map (lambda (file)
+ (string-append file suffix))
+ files))
+
+(define (write-rule lhs op rhs port)
+ (write-string lhs port)
+ (write-string " " port)
+ (write-string op port)
+ (write-string " " port)
+ (write-items rhs (+ (string-length lhs) (string-length op) 2) port))
+
+(define (write-items items start-column port)
+ (let loop ((items* items) (column start-column))
+ (if (pair? items*)
+ (let ((column
+ (if (eq? items* items)
+ column
+ (begin
+ (write-string " " port)
+ (+ column 1))))
+ (delta (string-length (car items*))))
+ (let ((new-column (+ column delta)))
+ (if (>= new-column 78)
+ (begin
+ (write-string "\\\n\t" port)
+ (write-string (car items*) port)
+ (loop (cdr items*) (+ 8 delta)))
+ (begin
+ (write-string (car items*) port)
+ (loop (cdr items*) new-column)))))
+ column)))
\f
(define (write-dependencies file-lists deps-filename output)
(maybe-update-dependencies
(map (lambda (base) (string-append base ".c"))
(cdr file-list)))
file-lists)
- string<?))
+ string<?))
(call-with-input-file deps-filename
(lambda (input)
(let ((buffer (make-string 4096)))
(let loop ((rules rules))
(if (pair? rules)
(begin
- (write-rule (car rules) output)
+ (write-rule (caar rules) ":" (cdar rules) output)
(if (pair? (cdr rules))
(begin
(newline output)
- (loop (cdr rules))))))))))))
+ (loop (cdr rules)))))))
+ (newline output))))))
(define (generate-rule filename)
(parse-rule
(unbreak-lines
- ((if (lexical-unreferenceable? system-global-environment ; E.g., Build 7.7
- 'call-with-output-string) ; using 7.6?
- with-string-output-port ;; For backward compatibility (pre-7.7)
- call-with-output-string)
+ (with-string-output-port
(lambda (port)
(run-shell-command (string-append "./makegen-cc " filename)
'OUTPUT port))))))
(cons* (string-head (car items) (- (string-length (car items)) 1))
(cadr items)
(sort (list-transform-negative (cddr items) pathname-absolute?)
- string<?))))
-\f
-(define (write-rule rule port)
- (write-string (car rule) port)
- (write-string ": " port)
- (write-items (cdr rule) (+ (string-length (car rule)) 2) port))
-
-(define (write-items items start-column port)
- (let loop ((items* items) (column start-column))
- (if (pair? items*)
- (let ((column
- (if (eq? items* items)
- column
- (begin
- (write-string " " port)
- (+ column 1))))
- (delta (string-length (car items*))))
- (let ((new-column (+ column delta)))
- (if (>= new-column 78)
- (begin
- (write-string "\\\n\t" port)
- (write-string (car items*) port)
- (loop (cdr items*) (+ 8 delta)))
- (begin
- (write-string (car items*) port)
- (loop (cdr items*) new-column)))))
- column)))
+ string<?))))
\ No newline at end of file
#!/bin/sh
-# $Id: makeinit.sh,v 1.15 2007/01/05 21:19:26 cph Exp $
+# $Id: makeinit.sh,v 1.16 2007/01/12 02:57:10 cph Exp $
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
SCHEME_LARGE="scheme --large"
fi
${SCHEME_LARGE} <<EOF
-(load "makegen/makegen.scm")
-(generate-makefile "makegen/Makefile.in.in"
- "Makefile.deps"
- "Makefile.in")
+(begin
+ (load "makegen/makegen.scm")
+ (generate-makefile))
EOF
# Clean up.