summaryrefslogtreecommitdiffstats
path: root/build.scm
diff options
context:
space:
mode:
Diffstat (limited to 'build.scm')
-rw-r--r--build.scm2344
1 files changed, 1206 insertions, 1138 deletions
diff --git a/build.scm b/build.scm
index 5a13240..4c4d88d 100644
--- a/build.scm
+++ b/build.scm
@@ -1,9 +1,10 @@
;;; "build.scm" Build database and program -*-scheme-*-
-;;; Copyright (C) 1994, 1995, 1996, 1997 Aubrey Jaffer.
+;;; Copyright (C) 1994-1999 Aubrey Jaffer.
;;; See the file `COPYING' for terms applying to this program.
(require 'parameters)
(require 'database-utilities)
+(set! OPEN_WRITE "w") ; Because MS-DOS scripts need ^M
;;;(define build (create-database "buildscm.scm" 'alist-table))
(define build (create-database #f 'alist-table))
@@ -11,9 +12,10 @@
(require 'glob)
(require 'batch)
(batch:initialize! build)
-((((build 'open-table) 'batch-dialect #t) 'row:insert) '(default-for-platform))
+((((build 'open-table) 'batch-dialect #t) 'row:insert)
+ '(default-for-platform 0))
-(set! OPEN_WRITE "w") ; Because MS-DOS scripts need ^M
+;;;; This first part is about SCM files and features.
(define-tables build
@@ -44,22 +46,6 @@
(test "test SCM")
(none "no files")))
- '(build-whats
- ((name symbol))
- ((class file-categories)
- (c-proc symbol)
- (o-proc symbol)
- (spec expression)
- (documentation string))
- ((exe required compile-c-files link-c-program #f
- "executable program")
- (lib required compile-c-files make-archive ((define "RTL"))
- "library module")
- (dlls linkable compile-dll-c-files make-dll-archive ((define "DLL"))
- "archived dynamically linked library object files")
- (dll none compile-dll-c-files update-catalog ((define "DLL"))
- "dynamically linked library object file")))
-
'(manifest
((file string)
(format file-formats)
@@ -95,7 +81,8 @@
("continue.h" c-header required "continuations.")
("continue.c" c-source required "continuations.")
("scm.h" c-header required "data type and external definitions of SCM.")
- ("scm.c" c-source required "top level, interrupts, and non-IEEE utility functions.")
+ ("scm.c" c-source required "initialization, interrupts, and non-IEEE utility functions.")
+ ("scmmain.c" c-source required "initialization, interrupts, and non-IEEE utility functions.")
("findexec.c" c-source required "find the executable file function.")
("script.c" c-source required "utilities for running as `#!' script.")
("time.c" c-source required "functions dealing with time.")
@@ -127,14 +114,283 @@
("unexhp9k800.c" c-source platform-specific "Convert a running HP-UX program into an executable file.")
("unexelf.c" c-source platform-specific "Convert a running ELF program into an executable file.")
("unexalpha.c" c-source platform-specific "Convert a running program into an Alpha executable file.")
+ ("unexsgi.c" c-source platform-specific "Convert a running program into an IRIX executable file.")
("unexsunos4.c" c-source platform-specific "Convert a running program into an executable file.")
- )))
+ ))
+
+ '(build-whats
+ ((name symbol))
+ ((class file-categories)
+ (c-proc symbol)
+ (o-proc symbol)
+ (spec expression)
+ (documentation string))
+ ((exe required compile-c-files link-c-program #f
+ "executable program")
+ (lib required compile-c-files make-archive ((c-lib lib))
+ "library module")
+ (dlls linkable compile-dll-c-files make-dll-archive ((define "DLL"))
+ "archived dynamically linked library object files")
+ (dll none compile-dll-c-files update-catalog ((define "DLL"))
+ "dynamically linked library object file")))
+
+ '(features
+ ((name symbol))
+ ((spec expression)
+ (documentation string))
+ ((none () "No features"))))
(for-each (build 'add-domain)
'((optstring #f (lambda (x) (or (not x) (string? x))) string #f)
(filename #f #f string #f)
+ (features features #f symbol #f)
(build-whats build-whats #f symbol #f)))
+(define define-build-feature
+ (let ((defeature (((build 'open-table) 'features #t) 'row:insert)))
+ (lambda args
+ (defeature (append args (list (comment)))))))
+
+#;Lightweight -- no features
+(define-build-feature
+ 'lit
+ '())
+
+#;Normally, the number of arguments arguments to interpreted closures
+#;(from LAMBDA) are checked if the function part of a form is not a
+#;symbol or only the first time the form is executed if the function
+#;part is a symbol. defining @samp{reckless} disables any checking.
+#;If you want to have SCM always check the number of arguments to
+#;interpreted closures define feature @samp{cautious}.
+(define-build-feature
+ 'cautious
+ '((define "CAUTIOUS")))
+
+#;Define this for extra checking of interrupt masking and some simple
+#;checks for proper use of malloc and free. This is for debugging C
+#;code in @file{sys.c}, @file{eval.c}, @file{repl.c} and makes the
+#;interpreter several times slower than usual.
+(define-build-feature
+ 'careful-interrupt-masking
+ '((define "CAREFUL_INTS")))
+
+#;Turns on the features @samp{cautious},
+#;@samp{careful-interrupt-masking}, and @samp{stack-limit}; uses
+#;@code{-g} flags for debugging SCM source code.
+(define-build-feature
+ 'debug
+ '((c-lib debug) (features cautious careful-interrupt-masking stack-limit)))
+
+#;If your scheme code runs without any errors you can disable almost
+#;all error checking by compiling all files with @samp{reckless}.
+(define-build-feature
+ 'reckless
+ '((define "RECKLESS")))
+
+#;Use to enable checking for stack overflow. Define value of the C
+#;preprocessor variable @var{STACK_LIMIT} to be the size to which SCM
+#;should allow the stack to grow. STACK_LIMIT should be less than the
+#;maximum size the hardware can support, as not every routine checks the
+#;stack.
+(define-build-feature
+ 'stack-limit
+ '((define ("STACK_LIMIT" "(HEAP_SEG_SIZE/2)"))))
+
+#;C level support for hygienic and referentially transparent macros
+#;(syntax-rules macros).
+(define-build-feature
+ 'macro
+ '((define "MACRO") (features rev2-procedures record)))
+
+#;Large precision integers.
+(define-build-feature
+ 'bignums
+ '((define "BIGNUMS")))
+
+#;Use if you want arrays, uniform-arrays and uniform-vectors.
+(define-build-feature
+ 'arrays
+ '((define "ARRAYS")))
+
+#;Alias for ARRAYS
+(define-build-feature
+ 'array
+ '((define "ARRAYS")))
+
+#;array-map! and array-for-each (arrays must also be featured).
+(define-build-feature
+ 'array-for-each
+ '((c-file "ramap.c") (init "init_ramap")))
+
+#;Use if you want floating point numbers.
+(define-build-feature
+ 'inexact
+ '((define "FLOATS") (c-lib m)))
+
+#;Use if you want floats to display in engineering notation (exponents
+#;always multiples of 3) instead of scientific notation.
+(define-build-feature
+ 'engineering-notation
+ '((define "ENGNOT")))
+
+#;Use if you want all inexact real numbers to be single precision. This
+#;only has an effect if SINGLES is also defined (which is the default).
+#;This does not affect complex numbers.
+(define-build-feature
+ 'single-precision-only
+ '((define "SINGLESONLY")))
+
+#;Use if you want to run code from:
+#;
+#;@cindex SICP
+#;Harold Abelson and Gerald Jay Sussman with Julie Sussman.
+#;@cite{Structure and Interpretation of Computer Programs.}
+#;The MIT Press, Cambridge, Massachusetts, USA, 1985.
+#;
+#;Differences from R5RS are:
+#;@itemize @bullet
+#;@item
+#;(eq? '() '#f)
+#;@item
+#;(define a 25) returns the symbol a.
+#;@item
+#;(set! a 36) returns 36.
+#;@end itemize
+(define-build-feature
+ 'sicp
+ '((define "SICP")))
+
+#;These procedures were specified in the @cite{Revised^2 Report on Scheme}
+#;but not in @cite{R4RS}.
+(define-build-feature
+ 'rev2-procedures
+ '((c-file "sc2.c") (init "init_sc2")))
+
+#;The Record package provides a facility for user to define their own
+#;record data types. See SLIB for documentation.
+(define-build-feature
+ 'record
+ '((define "CCLO") (c-file "record.c") (init "init_record")))
+
+#;Use if you want to use compiled closures.
+(define-build-feature
+ 'compiled-closure
+ '((define "CCLO")))
+
+#;@code{make_gsubr} for arbitrary (< 11) arguments to C functions.
+(define-build-feature
+ 'generalized-c-arguments
+ '((c-file "gsubr.c") (init "init_gsubr")))
+
+#;Use if you want the ticks and ticks-interrupt functions.
+(define-build-feature
+ 'tick-interrupts
+ '((define "TICKS")))
+
+#;Commonly available I/O extensions: @dfn{exec}, line I/O, file
+#;positioning, file delete and rename, and directory functions.
+(define-build-feature
+ 'i/o-extensions
+ '((c-file "ioext.c") (init "init_ioext")))
+
+#;@dfn{Turtle} graphics calls for both Borland-C and X11 from
+#;sjm@@ee.tut.fi.
+(define-build-feature
+ 'turtlegr
+ '((c-file "turtlegr.c") (c-lib graphics) (features inexact)
+ (init "init_turtlegr")))
+
+#;Interface to Xlib graphics routines.
+(define-build-feature
+ 'Xlib
+ '((c-file "x.c") (c-lib graphics) (compiled-init "init_x") (features arrays)))
+
+#;Alias for Xlib feature.
+(define-build-feature
+ 'X
+ '((features Xlib)))
+
+#;For the @dfn{curses} screen management package.
+(define-build-feature
+ 'curses
+ '((c-file "crs.c") (c-lib curses) (init "init_crs")))
+
+#;interface to the editline or GNU readline library.
+(define-build-feature
+ 'edit-line
+ '((c-file "edline.c") (c-lib termcap editline) (compiled-init "init_edline")))
+
+#;Client connections to the mysql databases.
+(define-build-feature
+ 'mysql
+ '((c-file "database.c") (c-lib mysql) (init "init_database")))
+
+#;String regular expression matching.
+(define-build-feature
+ 'regex
+ '((c-file "rgx.c") (c-lib regex) (init "init_rgx")))
+
+#;BSD @dfn{socket} interface.
+(define-build-feature
+ 'socket
+ '((c-lib socket) (c-file "socket.c") (init "init_socket")))
+
+#;Posix functions available on all @dfn{Unix-like} systems. fork and
+#;process functions, user and group IDs, file permissions, and
+#;@dfn{link}.
+(define-build-feature
+ 'posix
+ '((c-file "posix.c") (init "init_posix")))
+
+#;Those unix features which have not made it into the Posix specs:
+#;nice, acct, lstat, readlink, symlink, mknod and sync.
+(define-build-feature
+ 'unix
+ '((c-file "unix.c") (init "init_unix")))
+
+#;Microsoft Windows executable.
+(define-build-feature
+ 'windows
+ '((c-lib windows))) ; (define "NON_PREEMPTIVE")
+
+#;Be able to load compiled files while running.
+(define-build-feature
+ 'dynamic-linking
+ '((c-file "dynl.c") (c-lib dlll)))
+
+#;Convert a running scheme program into an executable file.
+(define-build-feature
+ 'dump
+ '((define "CAN_DUMP") (c-lib dump) (c-lib nostart)))
+
+;;; Descriptions of these parameters is in "setjump.h".
+;; (initial-heap-size ((define "INIT_HEAP_SIZE" (* 25000 sizeof-cell))))
+;; (heap-segment-size ((define "HEAP_SEG_SIZE" (* 8100 sizeof-cell))))
+;; (short-aligned-stack ((define "SHORT_ALIGN")))
+;; (initial-malloc-limit ((define "INIT_MALLOC_LIMIT" 100000)))
+;; (number-of-hash-buckets ((define "NUM_HASH_BUCKETS" 137)))
+;; (minimum-gc-yield ((define "MIN_GC_YIELD" "(heap_cells/4)")))
+
+#;Use if you want segments of unused heap to not be freed up after
+#;garbage collection. This may increase time in GC for *very* large
+#;working sets.
+(define-build-feature
+ 'no-heap-shrink
+ '((define "DONT_GC_FREE_SEGMENTS")))
+
+#;If you only need straight stack continuations, executables compile with
+#;this feature will run faster and use less storage than not having it.
+#;Machines with unusual stacks @emph{need} this. Also, if you incorporate
+#;new C code into scm which uses VMS system services or library routines
+#;(which need to unwind the stack in an ordrly manner) you may need to
+#;use this feature.
+(define-build-feature
+ 'cheap-continuations
+ '((define "CHEAP_CONTINUATIONS")))
+
+
+;;;; The rest is about building on specific platforms.
+
(define-tables build
'(processor-family
@@ -166,43 +422,46 @@
((name symbol))
((processor processor-family)
(operating-system operating-system)
- (compiler symbol))
- ((*unknown* *unknown* unix *unknown*)
- (acorn-unixlib acorn *unknown* *unknown*)
- (aix powerpc aix *unknown*)
- (alpha alpha osf1 cc)
- (alpha-elf alpha unix *unknown*)
- (alpha-linux alpha linux gcc)
- (amiga-aztec m68000 amiga aztec)
- (amiga-dice-c m68000 amiga dice-c)
- (amiga-gcc m68000 amiga gcc)
- (amiga-sas/c-5.10 m68000 amiga sas/c)
- (atari-st-gcc m68000 atari.st gcc)
- (atari-st-turbo-c m68000 atari.st turbo-c)
- (borland-c-3.1 8086 ms-dos borland-c)
- (cygwin32 i386 unix gcc)
- (djgpp i386 ms-dos gcc)
- (freebsd i386 unix cc)
- (gcc *unknown* unix gcc)
- (highc.31 i386 ms-dos highc)
- (hp-ux hp-risc hp-ux *unknown*)
- (linux i386 linux gcc)
- (linux-aout i386 linux gcc)
- (microsoft-c 8086 ms-dos microsoft-c)
- (microsoft-c-nt i386 ms-dos microsoft-c)
- (microsoft-quick-c 8086 ms-dos microsoft-quick-c)
- (ms-dos 8086 ms-dos *unknown*)
- (os/2-cset i386 os/2 C-Set++)
- (os/2-emx i386 os/2 gcc)
- (sun-svr4-gcc-sunld sparc sunos gcc)
- (sunos sparc sunos *unknown*)
- (svr4 *unknown* unix *unknown*)
- (turbo-c-2 8086 ms-dos turbo-c)
- (unicos cray unicos *unknown*)
- (unix *unknown* unix *unknown*)
- (vms vax vms *unknown*)
- (vms-gcc vax vms gcc)
- (watcom-9.0 i386 ms-dos watcom)
+ (compiler symbol)
+ ;;(linker symbol)
+ )
+ ((*unknown* *unknown* unix cc ) ;ld
+ (acorn-unixlib acorn *unknown* cc ) ;link
+ (aix powerpc aix cc ) ;cc
+ (alpha alpha osf1 cc ) ;cc
+ (alpha-elf alpha unix cc ) ;cc
+ (alpha-linux alpha linux gcc ) ;gcc
+ (amiga-aztec m68000 amiga cc ) ;cc
+ (amiga-dice-c m68000 amiga dcc ) ;dcc
+ (amiga-gcc m68000 amiga gcc ) ;gcc
+ (amiga-sas m68000 amiga lc ) ;link
+ (atari-st-gcc m68000 atari.st gcc ) ;gcc
+ (atari-st-turbo-c m68000 atari.st tcc ) ;tlink
+ (borland-c 8086 ms-dos bcc ) ;bcc
+ (cygwin32 i386 unix gcc ) ;gcc
+ (djgpp i386 ms-dos gcc ) ;gcc
+ (freebsd i386 unix cc ) ;cc
+ (gcc *unknown* unix gcc ) ;gcc
+ (highc i386 ms-dos hc386 ) ;bind386
+ (hp-ux hp-risc hp-ux cc ) ;cc
+ (irix mips irix gcc ) ;gcc
+ (linux i386 linux gcc ) ;gcc
+ (linux-aout i386 linux gcc ) ;gcc
+ (microsoft-c 8086 ms-dos cl ) ;link
+ (microsoft-c-nt i386 ms-dos cl ) ;link
+ (microsoft-quick-c 8086 ms-dos qcl ) ;qlink
+ (ms-dos 8086 ms-dos cc ) ;link
+ (os/2-cset i386 os/2 icc ) ;link386
+ (os/2-emx i386 os/2 gcc ) ;gcc
+ (svr4-gcc-sun-ld sparc sunos gcc ) ;ld
+ (sunos sparc sunos cc ) ;ld
+ (svr4 *unknown* unix cc ) ;ld
+ (turbo-c 8086 ms-dos tcc ) ;tcc
+ (unicos cray unicos cc ) ;cc
+ (unix *unknown* unix cc ) ;cc
+ (vms vax vms cc ) ;link
+ (vms-gcc vax vms gcc ) ;link
+ (watcom-9.0 i386 ms-dos wcc386p ) ;wlinkp
))
'(C-libraries
@@ -224,6 +483,9 @@
(termcap *unknown* "" "-ltermcap" "/usr/lib/libtermcap.a" () ())
(debug *unknown* "-g" "-g" #f () ())
(socket *unknown* "" "" #f () ())
+ (lib *unknown* "" "" #f () ("scmmain.c"))
+ (mysql *unknown* ""
+ "-lmysqlclient" "/usr/lib/mysql/libmysqlclient.la" () ())
(c cygwin32 "" "" "" () ())
(m linux-aout "" "-lm" "/usr/lib/libm.sa" () ())
@@ -244,14 +506,16 @@
(nostart linux "" "" #f () ())
(dump linux "" "" #f ("unexelf.c" "gmalloc.c") ())
+ (dump irix "" "-G 0" #f () ())
+
(m acorn-unixlib "" "" #f () ())
(nostart alpha "" "-non_shared" #f ("pre-crt0.c") ())
(dump alpha "" "" #f ("unexalpha.c") ())
(m amiga-dice-c "" "-lm" #f () ())
- (m amiga-SAS/C-5.10 "" "lcmieee.lib" #f () ())
- (c amiga-SAS/C-5.10 "" "lc.lib" #f () ())
+ (m amiga-sas "" "lcmieee.lib" #f () ())
+ (c amiga-sas "" "lc.lib" #f () ())
(m vms-gcc "" "" #f () ())
(m vms "" "" #f () ())
@@ -264,12 +528,12 @@
(nostart sunos "" "-e __start -nostartfiles -static" #f ("ecrt0.c") ())
(dump sunos "" "" #f ("unexelf.c" "gmalloc.c") ())
- (m sun-svr4-gcc-sunld "" "-lm" #f () ())
- (dlll sun-svr4-gcc-sunld "-DSUN_DL" "-Wl,-ldl" #f () ())
- (nostart sun-svr4-gcc-sunld "" "-e __start -nostartfiles" #f ("ecrt0.c") ())
- (dump sun-svr4-gcc-sunld "" "" #f ("unexelf.c" "gmalloc.c") ())
- (socket sun-svr4-gcc-sunld "" "-lsocket -lnsl" #f () ())
- (regex sun-svr4-gcc-sunld "" "" #f () ())
+ (m svr4-gcc-sun-ld "" "-lm" #f () ())
+ (dlll svr4-gcc-sun-ld "-DSUN_DL" "-Wl,-ldl" #f () ())
+ (nostart svr4-gcc-sun-ld "" "-e __start -nostartfiles" #f ("ecrt0.c") ())
+ (dump svr4-gcc-sun-ld "" "" #f ("unexelf.c" "gmalloc.c") ())
+ (socket svr4-gcc-sun-ld "" "-lsocket -lnsl" #f () ())
+ (regex svr4-gcc-sun-ld "" "" #f () ())
(nostart gcc "" "-e __start -nostartfiles" #f ("ecrt0.c") ())
(dump gcc "" "" #f ("unexelf.c" "gmalloc.c") ())
@@ -298,18 +562,18 @@
(c Microsoft-Quick-C "" "" #f () ("findexec.c"))
(m Microsoft-Quick-C "" "" #f () ())
- (c Turbo-C-2 "" "" #f () ("findexec.c"))
- (m Turbo-C-2 "" "" #f () ())
- (graphics Turbo-C-2 "" "graphics.lib" #f () ())
+ (c turbo-c "" "" #f () ("findexec.c"))
+ (m turbo-c "" "" #f () ())
+ (graphics turbo-c "" "graphics.lib" #f () ())
- (c Borland-C-3.1 "" "" #f () ("findexec.c"))
- (m Borland-C-3.1 "" "" #f () ())
- (graphics Borland-C-3.1 "" "graphics.lib" #f () ())
- (windows Borland-C-3.1 "-N -W" "-W" #f () ())
+ (c borland-c "" "" #f () ("findexec.c"))
+ (m borland-c "" "" #f () ())
+ (graphics borland-c "" "graphics.lib" #f () ())
+ (windows borland-c "-N -W" "-W" #f () ())
- (c highc.31 "" "" #f () ("findexec.c"))
- (m highc.31 "" "" #f () ())
- (windows highc.31 "-Hwin" "-Hwin" #f () ())
+ (c highc "" "" #f () ("findexec.c"))
+ (m highc "" "" #f () ())
+ (windows highc "-Hwin" "-Hwin" #f () ())
(m freebsd "" "-lm" #f () ())
(regex freebsd "" "-lgnuregex" "" () ())
@@ -323,1035 +587,818 @@
((name symbol)
(platform platform))
((procedure expression))
-
- ((compile-c-files Borland-C-3.1
- (lambda (files parms)
- (define rsp-name "temp.rsp")
- (apply batch:lines->file parms rsp-name files)
- (and (batch:try-system
- parms
- "bcc" "-d" "-O" "-Z" "-G" "-w-pro" "-ml" "-c"
- (if (member '(define "FLOATS" #t)
- (c-defines parms))
- "" "-f-")
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- (string-append "@" rsp-name))
- (truncate-up-to
- (replace-suffix files ".c" ".obj")
- #\\))))
- (link-c-program Borland-C-3.1
- (lambda (oname objects libs parms)
- (define lnk-name (string-append oname ".lnk"))
- (apply batch:lines->file parms
- lnk-name
- (append libs objects))
- (and (batch:try-system
- parms "bcc" (string-append "-e" oname)
- "-ml" (string-append "@" lnk-name))
- (string-append oname ".exe"))))
-
- (compile-c-files Turbo-C-2
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "tcc" "-c" "-d" "-O" "-Z" "-G" "-ml" "-c"
- "-Ic:\\turboc\\include"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".obj")
- #\\))))
- (link-c-program Turbo-C-2
- (lambda (oname objects libs parms)
- (let ((exe (truncate-up-to
- (replace-suffix (car objects) ".obj" ".exe")
- #\\))
- (oexe (string-append oname ".exe")))
- (and (or (string-ci=? exe oexe)
- (batch:delete-file parms oexe))
- (batch:try-system
- parms "tcc" "-Lc:\\turboc\\lib" libs objects)
- (or (string-ci=? exe oexe)
- (batch:rename-file parms exe oexe))
- oexe))))
-
- (compile-c-files Microsoft-C
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms "cl" "-c" "Oxp" "-AH"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".obj")
- #\\))))
- (link-c-program Microsoft-C
- (lambda (oname objects libs parms)
- (let ((exe (truncate-up-to
- (replace-suffix (car objects) ".obj" ".exe")
- #\\))
- (oexe (string-append oname ".exe")))
- (and (or (string-ci=? exe oexe)
- (batch:delete-file parms oexe))
- (batch:try-system
- parms "link" "/noe" "/ST:40000"
- (apply string-join "+"
- (map (lambda (o)
- (replace-suffix o ".obj" ""))
- objects))
- libs)
- (or (string-ci=? exe oexe)
- (batch:rename-file parms exe oexe))
- oexe))))
- (compile-c-files Microsoft-C-nt
- (lambda (files parms)
- (and (batch:chop-to-fit-system parms
- "cl" "-c" "-nologo" "-O2"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".obj")
- #\\))))
- (link-c-program Microsoft-C-nt
+ ((update-catalog *unknown*
(lambda (oname objects libs parms)
- (let ((exe (truncate-up-to
- (replace-suffix (car objects) ".obj" ".exe")
- #\\))
- (oexe (string-append oname ".exe")))
- (and (batch:try-system
- parms "link" "/nologo"
- (string-append "/out:" oexe)
- (apply string-join " "
- (map (lambda (o)
- (replace-suffix o ".obj" ""))
- objects))
- libs)
- oexe))))
-
- (compile-c-files Microsoft-Quick-C
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "qcl" "/AH" "/W1" "/Ze" "/O" "/Ot" "/DNDEBUG"
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".obj")
- #\\))))
- (link-c-program Microsoft-Quick-C
- (lambda (oname objects libs parms)
- (define crf-name (string-append oname ".crf"))
- (apply batch:lines->file parms
- crf-name
- `(,@(map (lambda (f) (string-append f " +"))
- objects)
- ""
- ,(string-append oname ".exe")
- ,(apply string-join " " libs)
- ";"))
- (and (batch:try-system
- parms "qlink"
- "/CP:0xffff" "/NOI" "/SE:0x80" "/ST:0x9c40"
- crf-name)
- (string-append oname ".exe"))))
-
- (compile-c-files Watcom-9.0
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "wcc386p" "/mf" "/d2" "/ze" "/oxt" "/3s"
- "/zq" "/w3"
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".obj")
- #\\))))
- (link-c-program Watcom-9.0
- (lambda (oname objects libs parms)
- (let ((exe (truncate-up-to
- (replace-suffix (car objects)
- ".obj" ".exe")
- #\\))
- (oexe (string-append oname ".exe")))
- (and (or (string-ci=? exe oexe)
- (batch:delete-file parms oexe))
- (batch:try-system
- parms
- "wlinkp" "option" "quiet" "option"
- "stack=40000" "FILE"
- (apply string-join ","
- (map (lambda (o)
- (replace-suffix o ".obj" ""))
- objects))
- libs)
- (if (not (string-ci=? exe oexe))
- (batch:rename-file parms exe oexe))
- oexe))))
- (compile-c-files highc.31
- (lambda (files parms)
- (define hcc-name "temp.hcc")
- (apply batch:lines->file parms hcc-name files)
- (and (batch:try-system
- parms
- "d:\\hi_c\\hc386.31\\bin\\hc386"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- "-c" (string-append "@" hcc-name))
- (truncate-up-to
- (replace-suffix files ".c" ".obj")
- #\\))))
- (link-c-program highc.31
- (lambda (oname objects libs parms)
- (let ((oexe (string-append oname ".exe")))
- (define lnk-name (string-append oname ".lnk"))
- (apply batch:lines->file parms
- lnk-name (append libs objects))
- (and (batch:try-system
- parms
- "d:\\hi_c\\hc386.31\\bin\\hc386" "-o" oname
- "-stack 65000"
- (string-append "@" lnk-name))
- (batch:try-system
- parms
- "bind386" "d:/hi_c/pharlap.51/run386b.exe" oname
- "-exe" oexe)
- oexe))))
-
- (compile-c-files djgpp
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "gcc" "-Wall" "-O2" "-c"
- (include-spec "-I" parms)
- (c-includes parms) (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".o")
- "\\/"))))
- (link-c-program djgpp
- (lambda (oname objects libs parms)
- (let ((exe (string-append oname ".exe")))
- (and (or (batch:try-system parms
- "gcc" "-o" oname
- (must-be-first
- '("-nostartfiles"
- "pre-crt0.o" "ecrt0.o"
- "c:/djgpp/lib/crt0.o")
- (append objects libs)))
- (let ((arname (string-append oname ".a")))
- (batch:delete-file parms arname)
- (and (batch:chop-to-fit-system
- parms
- "ar" "r" arname objects)
- (batch:try-system
- parms "gcc" "-o" oname
- (must-be-first
- '("-nostartfiles"
- "pre-crt0.o" "ecrt0.o"
- "c:/djgpp/lib/crt0.o")
- (cons arname libs)))
- (batch:delete-file parms arname)))
- ;;(build:error 'build "couldn't build archive")
- )
- (batch:try-system parms "strip" exe)
- (batch:delete-file parms oname)
- ;;(batch:delete-file parms exe)
- ;;(batch:try-system parms "coff2exe" "-s" "c:\\djgpp\\bin\\go32.exe" oname)
- exe))))
-
- (compile-c-files os/2-emx
- (lambda (files parms)
- (and (batch:chop-to-fit-system parms
- "gcc" "-O" "-m386" "-c"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".o")
- #\\))))
- (link-c-program os/2-emx
- (lambda (oname objects libs parms)
- (and (batch:try-system
- parms "gcc" "-o" (string-append oname ".exe")
- objects libs)
- (string-append oname ".exe"))))
-
- (compile-c-files os/2-cset
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms "icc.exe" "/Gd-" "/Ge+" "/Gm+" "/Q" "-c"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to (replace-suffix files ".c" ".obj")
- #\\))))
- (link-c-program os/2-cset
- (lambda (oname objects libs parms)
- (and (batch:try-system
- parms "link386.exe" objects libs
- (string-append "," oname ".exe,,,;"))
- (string-append oname ".exe"))))
-
- (compile-c-files HP-UX
- (lambda (files parms)
- (and (batch:chop-to-fit-system parms
- "cc" "+O1" "-c"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to (replace-suffix files ".c" ".o")
- #\/))))
- (compile-dll-c-files HP-UX
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms "cc" "+O1" "-Wl,-E" "+z" "-c"
- (c-includes parms)
- (c-flags parms)
- files)
- (let ((results
- (map
- (lambda (fname)
- (batch:rename-file
- parms
- (string-append fname ".sl")
- (string-append fname ".sl~"))
- (and (batch:try-system
- parms "ld" "-b" "-o"
- (string-append fname ".sl")
- (string-append fname ".o"))
- (string-append fname ".sl")))
- (truncate-up-to
- (replace-suffix files ".c" "")
- #\/))))
- (and (apply and? results) results)))))
+ (batch:rebuild-catalog parms)
+ (if (= 1 (length objects)) (car objects)
+ objects))))))
+
+(define define-compile-commands
+ (let ((defcomms (((build 'open-table) 'compile-commands #t) 'row:insert)))
+ (lambda args
+ (defcomms args)))) ;(append args (list (comment)))
+(defmacro defcommand (name platform procedure)
+ `(define-compile-commands ',name ',platform ',procedure))
+
+(defcommand compile-c-files borland-c
+ (lambda (files parms)
+ (define rsp-name "temp.rsp")
+ (apply batch:lines->file parms rsp-name files)
+ (and (batch:try-command
+ parms
+ "bcc" "-d" "-O" "-Z" "-G" "-w-pro" "-ml" "-c"
+ (if (member '(define "FLOATS" #t)
+ (c-defines parms))
+ "" "-f-")
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ (string-append "@" rsp-name))
+ (truncate-up-to (map c->obj files) #\\))))
+(defcommand link-c-program borland-c
+ (lambda (oname objects libs parms)
+ (define lnk-name (string-append oname ".lnk"))
+ (apply batch:lines->file parms
+ lnk-name
+ (append libs objects))
+ (and (batch:try-command
+ parms "bcc" (string-append "-e" oname)
+ "-ml" (string-append "@" lnk-name))
+ (string-append oname ".exe"))))
+
+(defcommand compile-c-files turbo-c
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "tcc" "-c" "-d" "-O" "-Z" "-G" "-ml" "-c"
+ "-Ic:\\turboc\\include"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->obj files) #\\))))
+(defcommand link-c-program turbo-c
+ (lambda (oname objects libs parms)
+ (let ((exe (truncate-up-to (obj->exe (car objects)) #\\))
+ (oexe (string-append oname ".exe")))
+ (and (or (string-ci=? exe oexe)
+ (batch:delete-file parms oexe))
+ (batch:try-command
+ parms "tcc" "-Lc:\\turboc\\lib" libs objects)
+ (or (string-ci=? exe oexe)
+ (batch:rename-file parms exe oexe))
+ oexe))))
+
+(defcommand compile-c-files Microsoft-C
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms "cl" "-c" "Oxp" "-AH"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->obj files) #\\))))
+(defcommand link-c-program Microsoft-C
+ (lambda (oname objects libs parms)
+ (let ((exe (truncate-up-to (obj->exe (car objects)) #\\))
+ (oexe (string-append oname ".exe")))
+ (and (or (string-ci=? exe oexe)
+ (batch:delete-file parms oexe))
+ (batch:try-command
+ parms "link" "/noe" "/ST:40000"
+ (apply string-join "+" (map obj-> objects))
+ libs)
+ (or (string-ci=? exe oexe)
+ (batch:rename-file parms exe oexe))
+ oexe))))
+(defcommand compile-c-files Microsoft-C-nt
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "cl" "-c" "-nologo" "-O2"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->obj files) #\\))))
+(defcommand link-c-program Microsoft-C-nt
+ (lambda (oname objects libs parms)
+ (let ((exe (truncate-up-to (obj->exe (car objects)) #\\))
+ (oexe (string-append oname ".exe")))
+ (and (batch:try-command
+ parms "link" "/nologo"
+ (string-append "/out:" oexe)
+ (apply string-join " " (map obj-> objects))
+ libs)
+ oexe))))
+
+(defcommand compile-c-files Microsoft-Quick-C
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "qcl" "/AH" "/W1" "/Ze" "/O" "/Ot" "/DNDEBUG"
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->obj files) #\\))))
+(defcommand link-c-program Microsoft-Quick-C
+ (lambda (oname objects libs parms)
+ (define crf-name (string-append oname ".crf"))
+ (apply batch:lines->file parms
+ crf-name
+ `(,@(map (lambda (f) (string-append f " +"))
+ objects)
+ ""
+ ,(string-append oname ".exe")
+ ,(apply string-join " " libs)
+ ";"))
+ (and (batch:try-command
+ parms "qlink"
+ "/CP:0xffff" "/NOI" "/SE:0x80" "/ST:0x9c40"
+ crf-name)
+ (string-append oname ".exe"))))
+
+(defcommand compile-c-files Watcom-9.0
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "wcc386p" "/mf" "/d2" "/ze" "/oxt" "/3s"
+ "/zq" "/w3"
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->obj files) #\\))))
+(defcommand link-c-program Watcom-9.0
+ (lambda (oname objects libs parms)
+ (let ((exe (truncate-up-to (obj->exe (car objects)) #\\))
+ (oexe (string-append oname ".exe")))
+ (and (or (string-ci=? exe oexe)
+ (batch:delete-file parms oexe))
+ (batch:try-command
+ parms
+ "wlinkp" "option" "quiet" "option"
+ "stack=40000" "FILE"
+ (apply string-join "," (map obj-> objects))
+ libs)
+ (if (not (string-ci=? exe oexe))
+ (batch:rename-file parms exe oexe))
+ oexe))))
+(defcommand compile-c-files highc
+ (lambda (files parms)
+ (define hcc-name "temp.hcc")
+ (apply batch:lines->file parms hcc-name files)
+ (and (batch:try-command
+ parms
+ "d:\\hi_c\\hc386.31\\bin\\hc386"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ "-c" (string-append "@" hcc-name))
+ (truncate-up-to (map c->obj files) #\\))))
+(defcommand link-c-program highc
+ (lambda (oname objects libs parms)
+ (let ((oexe (string-append oname ".exe")))
+ (define lnk-name (string-append oname ".lnk"))
+ (apply batch:lines->file parms
+ lnk-name (append libs objects))
+ (and (batch:try-command
+ parms
+ "d:\\hi_c\\hc386.31\\bin\\hc386" "-o" oname
+ "-stack 65000"
+ (string-append "@" lnk-name))
+ (batch:try-command
+ parms
+ "bind386" "d:/hi_c/pharlap.51/run386b.exe" oname
+ "-exe" oexe)
+ oexe))))
+
+(defcommand compile-c-files djgpp
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "gcc" "-Wall" "-O2" "-c"
+ (include-spec "-I" parms)
+ (c-includes parms) (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) "\\/"))))
+(defcommand link-c-program djgpp
+ (lambda (oname objects libs parms)
+ (let ((exe (string-append oname ".exe")))
+ (and (or (batch:try-command parms
+ "gcc" "-o" oname
+ (must-be-first
+ '("-nostartfiles"
+ "pre-crt0.o" "ecrt0.o"
+ "c:/djgpp/lib/crt0.o")
+ (append objects libs)))
+ (let ((arname (string-append oname ".a")))
+ (batch:delete-file parms arname)
+ (and (batch:try-chopped-command
+ parms
+ "ar" "r" arname objects)
+ (batch:try-command
+ parms "gcc" "-o" oname
+ (must-be-first
+ '("-nostartfiles"
+ "pre-crt0.o" "ecrt0.o"
+ "c:/djgpp/lib/crt0.o")
+ (cons arname libs)))
+ (batch:delete-file parms arname)))
+ ;;(build:error 'build "couldn't build archive")
+ )
+ (batch:try-command parms "strip" exe)
+ (batch:delete-file parms oname)
+ ;;(batch:delete-file parms exe)
+ ;;(batch:try-command parms "coff2exe" "-s" "c:\\djgpp\\bin\\go32.exe" oname)
+ exe))))
+
+(defcommand compile-c-files os/2-emx
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "gcc" "-O" "-m386" "-c"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\\))))
+(defcommand link-c-program os/2-emx
+ (lambda (oname objects libs parms)
+ (and (batch:try-command
+ parms "gcc" "-o" (string-append oname ".exe")
+ objects libs)
+ (string-append oname ".exe"))))
+
+(defcommand compile-c-files os/2-cset
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms "icc" "/Gd-" "/Ge+" "/Gm+" "/Q" "-c"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->obj files) #\\))))
+(defcommand link-c-program os/2-cset
+ (lambda (oname objects libs parms)
+ (and (batch:try-command
+ parms "link386" objects libs
+ (string-append "," oname ".exe,,,;"))
+ (string-append oname ".exe"))))
+
+(defcommand compile-c-files HP-UX
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "cc" "+O1" "-c"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand compile-dll-c-files HP-UX
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms "cc" "+O1" "-Wl,-E" "+z" "-c"
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (let ((results
+ (map
+ (lambda (fname)
+ (batch:rename-file
+ parms
+ (string-append fname ".sl")
+ (string-append fname ".sl~"))
+ (and (batch:try-command
+ parms "ld" "-b" "-o"
+ (string-append fname ".sl")
+ (string-append fname ".o"))
+ (string-append fname ".sl")))
+ (truncate-up-to (map c-> files) #\/))))
+ (and (apply and? results) results)))))
; (make-dll-archive HP-UX
; (lambda (oname objects libs parms)
-; (and (batch:try-system
+; (and (batch:try-command
; parms "ld" "-b" "-o" (string-append oname ".sl")
; objects)
; (batch:rebuild-catalog parms)
; (string-append oname ".sl"))))
- (make-dll-archive sunos
- (lambda (oname objects libs parms)
- (and (batch:try-system
- parms
- "ld" "-assert" "pure-text" "-o"
- (string-append
- (car (parameter-list-ref parms 'implvic))
- oname ".so.1.0")
- objects)
- (batch:rebuild-catalog parms)
- (string-append
- (car (parameter-list-ref parms 'implvic))
- oname ".so.1.0"))))
-
- (compile-c-files linux-aout
- (lambda (files parms)
- (and (batch:chop-to-fit-system parms
- "gcc" "-Wall" "-O2" "-c"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to (replace-suffix files ".c" ".o")
- #\/))))
- (compile-dll-c-files linux-aout
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "gcc" "-Wall" "-O2" "-c"
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".o")
- #\/))))
+(defcommand make-dll-archive sunos
+ (lambda (oname objects libs parms)
+ (and (batch:try-command
+ parms
+ "ld" "-assert" "pure-text" "-o"
+ (string-append
+ (car (parameter-list-ref parms 'implvic))
+ oname ".so.1.0")
+ objects)
+ (batch:rebuild-catalog parms)
+ (string-append
+ (car (parameter-list-ref parms 'implvic))
+ oname ".so.1.0"))))
+
+(defcommand compile-c-files linux-aout
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "gcc" "-Wall" "-O2" "-c"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand compile-dll-c-files linux-aout
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "gcc" "-Wall" "-O2" "-c"
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
;;; (make-dll-archive linux-aout
;;; (lambda (oname objects libs parms) #t
;;; (batch:rebuild-catalog parms)
;;; oname))
- (compile-c-files linux
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "gcc"
- (if (member "-g" (c-includes parms)) "" "-O2")
- "-c" (c-includes parms)
- (include-spec "-I" parms)
- (c-flags parms)
- files)
- (truncate-up-to (replace-suffix files ".c" ".o")
- #\/))))
- (compile-dll-c-files linux
- (lambda (files parms)
- (and
- (batch:chop-to-fit-system
- parms
- "gcc" "-O2" "-fpic" "-c" (c-includes parms)
- (c-flags parms)
- files)
- (let* ((platform (car (parameter-list-ref
- parms 'platform)))
- (ld-opts
- (map (lambda (l)
- (build:lib-ld-flag l platform))
- (parameter-list-ref parms 'c-lib)))
- (results
- (map
- (lambda (fname)
- (and (batch:try-system
- parms
- "gcc" "-shared" "-o"
- (string-append fname ".so")
- (string-append fname ".o")
- ld-opts)
- (string-append fname ".so")))
- (truncate-up-to
- (replace-suffix files ".c" "")
- #\/))))
- (and (apply and? results) results)))))
- (make-dll-archive linux
- (lambda (oname objects libs parms)
- (let ((platform (car (parameter-list-ref
- parms 'platform))))
- (and (batch:try-system
- parms
- "gcc" "-shared" "-o"
- (string-append
- (car (parameter-list-ref parms 'implvic))
- oname ".so")
- objects
- (map (lambda (l)
- (build:lib-ld-flag l platform))
- (parameter-list-ref parms 'c-lib)))
- (batch:rebuild-catalog parms)
- (string-append
- (car (parameter-list-ref parms 'implvic))
- oname ".so")))))
- (link-c-program linux
- (lambda (oname objects libs parms)
- (and (batch:try-system
- parms "gcc" "-rdynamic" "-o" oname
- (must-be-first
- '("pre-crt0.o" "ecrt0.o" "/usr/lib/crt0.o")
- (append objects libs)))
- oname)))
-
- (compile-c-files Unicos
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "cc" "-hvector2" "-hscalar2" "-c"
- (include-spec "-i" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to (replace-suffix files ".c" ".o")
- #\/))))
- (link-c-program unicos
- (lambda (oname objects libs parms)
- (and (batch:try-system
- parms "cc" "setjump.o" "-o" oname objects libs)
- oname)))
-
- (compile-c-files gcc
- (lambda (files parms)
- (and (batch:chop-to-fit-system parms
- "gcc" "-Wall" "-O2" "-c"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to (replace-suffix files ".c" ".o")
- #\/))))
- (link-c-program gcc
- (lambda (oname objects libs parms)
- (batch:rename-file parms
- oname (string-append oname "~"))
- (and (batch:try-system parms
- "gcc" "-o" oname
- (must-be-first
- '("-nostartfiles"
- "pre-crt0.o" "ecrt0.o"
- "/usr/lib/crt0.o")
- (append objects libs)))
- oname)))
-
- (compile-c-files cygwin32
- (lambda (files parms)
- (and (batch:chop-to-fit-system parms
- "gcc" "-Wall" "-O2" "-c"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".o")
- #\/))))
- (link-c-program cygwin32
- (lambda (oname objects libs parms)
- (batch:rename-file parms
- (string-append oname ".exe")
- (string-append oname "~"))
- (and (batch:try-system parms
- "gcc" "-o" oname
- (must-be-first
- '("-nostartfiles"
- "pre-crt0.o" "ecrt0.o"
- "/usr/lib/crt0.o")
- (append objects libs)))
- oname)))
-
- (compile-c-files sun-svr4-gcc-sunld
- (lambda (files parms)
- (and (batch:chop-to-fit-system parms
- "gcc" "-Wall" "-O2" "-c"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".o")
- #\/))))
- (link-c-program sun-svr4-gcc-sunld
- (lambda (oname objects libs parms)
- (batch:rename-file parms
- oname (string-append oname "~"))
- (and (batch:try-system parms
- "gcc" "-o" oname
- (must-be-first
- '("-nostartfiles"
- "pre-crt0.o" "ecrt0.o"
- "/usr/lib/crt0.o")
- (append objects libs)))
- oname)))
-
- (compile-c-files svr4
- (lambda (files parms)
- (and (batch:chop-to-fit-system parms
- "cc" "-O" "-DSVR4" "-c"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to (replace-suffix files ".c" ".o")
- #\/))))
-
- (compile-c-files aix
- (lambda (files parms)
- (and (batch:chop-to-fit-system parms
- "cc" "-O" "-Dunix" "-c"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to (replace-suffix files ".c" ".o")
- #\/))))
- (link-c-program aix
- (lambda (oname objects libs parms)
- (and (batch:try-system
- parms "cc" "-lansi" "-o" oname objects libs)
- oname)))
-
- (compile-c-files amiga-aztec
- (lambda (files parms)
- (and (batch:chop-to-fit-system parms
- "cc" "-dAMIGA"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to (replace-suffix files ".c" ".o")
- #\/))))
- (link-c-program amiga-aztec
- (lambda (oname objects libs parms)
- (and (batch:try-system
- parms "cc" "-o" oname objects libs "-lma")
- oname)))
-
- (compile-c-files amiga-SAS/C-5.10
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "lc" "-d3" "-M" "-fi" "-O"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (batch:try-system
- parms "blink with link.amiga NODEBUG")
- (truncate-up-to (replace-suffix files ".c" ".o")
- #\/))))
- (link-c-program amiga-SAS/C-5.10
- (lambda (oname objects libs parms)
- (define lnk-name "link.amiga")
- (apply batch:lines->file parms
- lnk-name
- (apply string-join "+" ">FROM LIB:c.o"
- (map object->string objects))
- (string-append
- "TO " (object->string (string-append "/" oname)))
- (append
- (cond
- ((pair? libs)
- (cons (string-append "LIB LIB:" (car libs))
- (map (lambda (s)
- (string-append " LIB:" s))
- (cdr libs))))
- (else '()))
- '("VERBOSE" "SC" "SD")))
- oname))
-
- (compile-c-files amiga-dice-c
- (lambda (files parms)
- (and (batch:try-system
- parms
- "dcc" "-r" "-gs" "-c"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files "-o" (truncate-up-to
- (replace-suffix files ".c" ".o")
- #\/))
- (truncate-up-to (replace-suffix files ".c" ".o")
- #\/))))
- (link-c-program amiga-dice-c
- (lambda (oname objects libs parms)
- (and (batch:try-system
- parms "dcc" "-r" "-gs" "-o" oname objects libs)
- oname)))
-
- (compile-c-files atari-st-gcc
- (lambda (files parms)
- (and (batch:chop-to-fit-system parms
- "gcc" "-v" "-O" "-c"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".o")
- #\/))))
- (link-c-program atari-st-gcc
- (lambda (oname objects libs parms)
- (and (batch:try-system
- parms "gcc" "-v" "-o" (string-append oname ".ttp")
- objects libs)
- (string-append oname ".ttp"))))
-
- (compile-c-files atari-st-turbo-c
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "tcc" "-P" "-W-" "-Datarist"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to (replace-suffix files ".c" ".o")
- #\/))))
- (link-c-program atari-st-turbo-c
- (lambda (oname objects libs parms)
- (and (batch:try-system
- parms "tlink" "-o" (string-append oname ".ttp")
- objects libs "mintlib.lib" "osbind.lib"
- "pcstdlib.lib" "pcfltlib.lib")
- (string-append oname ".ttp"))))
-
- (compile-c-files acorn-unixlib
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "cc" "-c" "-depend" "!Depend" "-IUnixLib:"
- "-pcc" "-Dunix" "-DSVR3" "-DARM_ULIB"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".o")
- #\/))))
- (link-c-program acorn-unixlib
- (lambda (oname objects libs parms)
- (and (batch:try-system
- parms "link" "-o" oname objects libs
- ":5.$.dev.gcc.unixlib36d.clib.o.unixlib")
- (batch:try-system parms "squeeze" oname)
- oname)))
-
- (compile-c-files vms
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "cc"
- (c-includes parms)
- (c-flags parms)
- (replace-suffix files ".c" ""))
- (truncate-up-to
- (replace-suffix files ".c" ".obj")
- "/]"))))
- (link-c-program vms
- (lambda (oname objects libs parms)
- (let ((exe (truncate-up-to
- (replace-suffix (car objects)
- ".obj" ".exe")
- "/]"))
- (oexe (string-append oname ".exe")))
- (and (batch:try-system parms "macro" "setjump")
- (batch:try-system
- parms
- "link"
- (apply string-join ","
- (append (map (lambda (f)
- (replace-suffix f ".obj" ""))
- objects)
- '("setjump" "sys$input/opt\n ")))
- (apply string-join
- "," (append (remove "" libs)
- '("sys$share:vaxcrtl/share"))))
- (or (string-ci=? exe oexe)
- (batch:rename-file parms exe oexe))
- oexe))))
-
- (compile-c-files vms-gcc
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "gcc"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- (replace-suffix files ".c" ""))
- (truncate-up-to
- (replace-suffix files ".c" ".obj")
- "/]"))))
- (link-c-program vms-gcc
- (lambda (oname objects libs parms)
- (let ((exe (truncate-up-to
- (replace-suffix (car objects) ".obj" ".exe")
- "/]"))
- (oexe (string-append oname ".exe")))
- (and (batch:try-system parms "macro" "setjump")
- (batch:try-system
- parms
- "link"
- (apply string-join ","
- (append objects
- '("setjump.obj"
- "sys$input/opt\n ")))
- (apply string-join
- "," (append (remove "" libs)
- '("gnu_cc:[000000]gcclib/lib"
- "sys$share:vaxcrtl/share"))))
- (or (string-ci=? exe oexe)
- (batch:rename-file parms exe oexe))
- oexe))))
-
- (compile-c-files *unknown*
- (lambda (files parms)
- (batch:chop-to-fit-system
- parms
- "cc" "-O" "-c"
- (include-spec "-I" parms)
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".o")
- "\\/]")))
- (link-c-program *unknown*
- (lambda (oname objects libs parms)
- (batch:rename-file parms
- oname (string-append oname "~"))
- (and (batch:try-system parms
- "cc" "-o" oname
- (must-be-first
- '("-nostartfiles"
- "pre-crt0.o" "ecrt0.o"
- "/usr/lib/crt0.o")
- (append objects libs)))
- oname)))
- (make-archive *unknown*
- (lambda (oname objects libs parms)
- (let ((aname (string-append oname ".a")))
- (and (batch:try-system parms "ar rc" aname objects)
- (batch:try-system parms "ranlib" aname)
- aname))))
- (compile-dll-c-files *unknown*
- (lambda (files parms)
- (and (batch:chop-to-fit-system parms
- "cc" "-O" "-c"
- (c-includes parms)
- (c-flags parms)
- files)
- (truncate-up-to
- (replace-suffix files ".c" ".o")
- "\\/]"))))
- (make-dll-archive *unknown*
- (lambda (oname objects libs parms)
- (let ((aname
- (string-append
- (car (parameter-list-ref parms 'implvic))
- oname ".a")))
- (and (batch:try-system parms "ar rc" aname objects)
- (batch:try-system parms "ranlib" aname)
- (batch:rebuild-catalog parms)
- aname))))
- (update-catalog *unknown*
- (lambda (oname objects libs parms)
- (batch:rebuild-catalog parms)
- (if (= 1 (length objects)) (car objects)
- objects)))
-
- (compile-c-files freebsd
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "cc" "-O" "-Dfreebsd" "-c"
- (c-includes parms)
- (c-flags parms)
- files)
- (replace-suffix files ".c" ".o"))))
- (link-c-program freebsd
- (lambda (oname objects libs parms)
- (batch:rename-file parms
- oname (string-append oname "~"))
- (and (batch:try-system parms
- "cc" "-o" oname
- (must-be-first
- '("-nostartfiles"
- "pre-crt0.o" "crt0.o"
- "/usr/lib/crt0.o")
- (append objects libs)))
- oname)))
- (compile-dll-c-files freebsd
- (lambda (files parms)
- (and (batch:chop-to-fit-system
- parms
- "cc" "-O" "-fpic" "-c"
- "-Dfreebsd"
- (string-append
- "-I" (parameter-list-ref parms 'scm-srcdir))
- (c-includes parms)
- (c-flags parms)
- files)
- (let ((objs (replace-suffix files ".c" ".o")))
- (every
- (lambda (f)
- (and (batch:try-system
- parms "ld" "-Bshareable" f)
- (batch:try-system
- parms "mv" "a.out" f)))
- objs)
- objs))))
-
- (make-dll-archive freebsd
- (lambda (oname objects libs parms)
- (and (batch:try-system
- parms
- "ld" "-Bshareable" "-o"
- (string-append
- (car (parameter-list-ref parms 'implvic))
- oname ".so")
- objects)
- (batch:rebuild-catalog parms)
- (string-append
- (car (parameter-list-ref parms 'implvic))
- oname ".so"))))
-
- ))
-
- '(features
- ((name symbol))
- ((spec expression)
- (documentation string))
- ((lit () "Light - no features")
- (none () "No features")
-
- (cautious ((define "CAUTIOUS"))
- "\
-Normally, the number of arguments arguments to interpreted closures
- (from LAMBDA) are checked if the function part of a form is not a
-symbol or only the first time the form is executed if the function
-part is a symbol. defining RECKLESS disables any checking. If you
-want to have SCM always check the number of arguments to interpreted
-closures #define CAUTIOUS.")
-
- (careful-interrupt-masking ((define "CAREFUL_INTS"))
- "\
-Define CAREFUL_INTS for extra checking of interrupt masking. This is
-for debugging C code in sys.c and repl.c.")
-
- (debug ((c-lib debug)
- (features cautious careful-interrupt-masking stack-limit))
- "Debugging")
-
- (reckless ((define "RECKLESS"))
- "\
-If your scheme code runs without any errors you can disable almost all
-error checking by compiling all files with RECKLESS.")
-
- (stack-limit ((define ("STACK_LIMIT" "(HEAP_SEG_SIZE/2)")))
- "\
-Define STACK_LIMIT to enable checking for stack overflow. Define
-value of STACK_LIMIT to be the size to which SCM should allow the
-stack to grow. STACK_LIMIT should be less than the maximum size the
-hardware can support, as not every routine checks the stack.")
-
- (macro ((define "MACRO") (features rev2-procedures record))
- "\
-R4RS-macros")
-
- (bignums ((define "BIGNUMS"))
- "\
-Large precision integers.")
-
- (arrays ((define "ARRAYS"))
- "\
-Define ARRAYS if you want arrays, uniform-arrays and uniform-vectors.")
-
- (array-for-each ((c-file "ramap.c") (init "init_ramap"))
- "\
-array-map! and array-for-each (ARRAYS must also be defined).")
-
- (inexact ((define "FLOATS") (c-lib m))
- "\
-Define FLOATS if you want floating point numbers.")
-
- (engineering-notation ((define "ENGNOT"))
- "\
-Define ENGNOT if you want floats to display in engineering notation
- (exponents always multiples of 3) instead of scientific notation.")
-
- (single-precision-only ((define "SINGLESONLY"))
- "\
-Define SINGLESONLY if you want all inexact real numbers to be single
-precision. This only has an effect if SINGLES is also defined (which
-is the default). This does not affect complex numbers.")
-
- (sicp ((define "SICP"))
- "\
-Define SICP if you want to run code from:
-
- H. Abelson, G. J. Sussman, and J. Sussman,
- Structure and Interpretation of Computer Programs,
- The MIT Press, Cambridge, Massachusetts, USA
-
- (eq? '() '#f) is the major difference.")
-
- (rev2-procedures ((c-file "sc2.c") (init "init_sc2"))
- "\
-These procedures were specified in the `Revised^2 Report on Scheme'
-but not in `R4RS'.")
-
- (record ((define "CCLO") (c-file "record.c") (init "init_record"))
- "\
-The Record package provides a facility for user to define their own
-record data types. See SLIB for documentation.")
-
- (compiled-closure ((define "CCLO"))
- "\
-Define CCLO if you want to use compiled closures.")
-
- (generalized-c-arguments ((c-file "gsubr.c") (init "init_gsubr"))
- "\
-make_gsubr for arbitrary (< 11) arguments to C functions.")
-
- (tick-interrupts ((define "TICKS"))
- "\
-Define TICKS if you want the ticks and ticks-interrupt functions.")
-
- (i/o-extensions ((c-file "ioext.c") (init "init_ioext"))
- "\
-Commonly available I/O extensions: `Exec', line I/O, file positioning,
-file delete and rename, and directory functions.")
-
- (turtlegr
- ((c-file "turtlegr.c") (c-lib graphics) (features inexact)
- (init "init_turtlegr"))
- "\
-`Turtle' graphics calls for both Borland-C and X11.")
-
- (curses ((c-file "crs.c") (c-lib curses) (init "init_crs"))
- "\
-`Curses' screen management package.")
-
- (edit-line
- ((c-file "edline.c") (c-lib termcap editline) (compiled-init "init_edline"))
- "\
-interface to the editline or GNU readline library")
-
- (regex ((c-file "rgx.c") (c-lib regex) (init "init_rgx"))
- "\
-String regular expression matching.")
-
- (socket ((c-lib socket) (c-file "socket.c") (init "init_socket"))
- "\
-BSD socket interface.")
-
- (posix ((c-file "posix.c") (init "init_posix"))
- "\
-Posix functions available on all `Unix-like' systems. fork and
-process functions, user and group IDs, file permissions, and `link'.")
-
- (unix ((c-file "unix.c") (init "init_unix"))
- "\
-Those unix features which have not made it into the Posix specs: nice,
-acct, lstat, readlink, symlink, mknod and sync.")
-
- (windows ((c-lib windows)) ; (define "NON_PREEMPTIVE")
- "\
-Microsoft Windows executable.")
-
- (dynamic-linking ((c-file "dynl.c") (c-lib dlll))
- "\
-Load compiled files while running.")
-
- (dump ((define "CAN_DUMP") (c-lib dump) (c-lib nostart))
- "\
-Convert a running scheme program into an executable file.")
-
-;;;; Descriptions of these parameters is in "setjump.h".
-;;; (initial-heap-size ((define "INIT_HEAP_SIZE" (* 25000 sizeof-cell))))
-;;; (heap-segment-size ((define "HEAP_SEG_SIZE" (* 8100 sizeof-cell))))
-;;; (short-aligned-stack ((define "SHORT_ALIGN")))
-;;; (initial-malloc-limit ((define "INIT_MALLOC_LIMIT" 100000)))
-;;; (number-of-hash-buckets ((define "NUM_HASH_BUCKETS" 137)))
-;;; (minimum-gc-yield ((define "MIN_GC_YIELD" "(heap_cells/4)")))
-
- (heap-can-shrink ((define "DONT_GC_FREE_SEGMENTS"))
- "\
-Define DONT_GC_FREE_SEGMENTS if you want segments of unused heap to
-not be freed up after garbage collection. This may reduce time in GC
-for *very* large working sets.")
-
- (cheap-continuations ((define "CHEAP_CONTINUATIONS"))
- "\
-If you only need straight stack continuations CHEAP_CONTINUATIONS will
-run faster and use less storage than not having it. Machines with
-unusual stacks need this. Also, if you incorporate new C code into
-scm which uses VMS system services or library routines (which need to
-unwind the stack in an ordrly manner) you may need to define
-CHEAP_CONTINUATIONS.")
- )))
+(defcommand compile-c-files linux
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "gcc" "-O2"
+ ;;(if (member "-g" (c-includes parms)) "" "-O2")
+ "-c" (c-includes parms)
+ (include-spec "-I" parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand compile-dll-c-files linux
+ (lambda (files parms)
+ (and
+ (batch:try-chopped-command
+ parms
+ "gcc" "-O2"
+ "-fpic" "-c" (c-includes parms)
+ (c-flags parms)
+ files)
+ (let* ((platform (car (parameter-list-ref
+ parms 'platform)))
+ (ld-opts
+ (map (lambda (l)
+ (build:lib-ld-flag l platform))
+ (parameter-list-ref parms 'c-lib)))
+ (results
+ (map
+ (lambda (fname)
+ (and (batch:try-command
+ parms
+ "gcc" "-shared" "-o"
+ (string-append fname ".so")
+ (string-append fname ".o")
+ ld-opts)
+ (batch:delete-file
+ parms (string-append fname ".o"))
+ (string-append fname ".so")))
+ (truncate-up-to (map c-> files) #\/))))
+ (and (apply and? results) results)))))
+(defcommand make-dll-archive linux
+ (lambda (oname objects libs parms)
+ (let ((platform (car (parameter-list-ref
+ parms 'platform))))
+ (and (batch:try-command
+ parms
+ "gcc" "-shared" "-o"
+ (string-append
+ (car (parameter-list-ref parms 'implvic))
+ oname ".so")
+ objects
+ (map (lambda (l)
+ (build:lib-ld-flag l platform))
+ (parameter-list-ref parms 'c-lib)))
+ (batch:rebuild-catalog parms)
+ (string-append
+ (car (parameter-list-ref parms 'implvic))
+ oname ".so")))))
+(defcommand link-c-program linux
+ (lambda (oname objects libs parms)
+ (and (batch:try-command
+ parms "gcc" "-rdynamic" "-o" oname
+ (must-be-first
+ '("pre-crt0.o" "ecrt0.o" "/usr/lib/crt0.o")
+ (append objects libs)))
+ oname)))
+
+(defcommand compile-c-files Unicos
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "cc" "-hvector2" "-hscalar2" "-c"
+ (include-spec "-i" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand link-c-program unicos
+ (lambda (oname objects libs parms)
+ (and (batch:try-command
+ parms "cc" "setjump.o" "-o" oname objects libs)
+ oname)))
+
+(defcommand compile-c-files gcc
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "gcc" "-O2" "-c" ; "-Wall"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand link-c-program gcc
+ (lambda (oname objects libs parms)
+ (batch:rename-file parms
+ oname (string-append oname "~"))
+ (and (batch:try-command parms
+ "gcc" "-o" oname
+ (must-be-first
+ '("-nostartfiles"
+ "pre-crt0.o" "ecrt0.o"
+ "/usr/lib/crt0.o")
+ (append objects libs)))
+ oname)))
+(defcommand compile-dll-c-files gcc
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "gcc" "-O" "-c"
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) "\\/]"))))
+
+(defcommand compile-c-files cygwin32
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "gcc" "-Wall" "-O2" "-c"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand link-c-program cygwin32
+ (lambda (oname objects libs parms)
+ (batch:rename-file parms
+ (string-append oname ".exe")
+ (string-append oname "~"))
+ (and (batch:try-command parms
+ "gcc" "-o" oname
+ (must-be-first
+ '("-nostartfiles"
+ "pre-crt0.o" "ecrt0.o"
+ "/usr/lib/crt0.o")
+ (append objects libs)))
+ oname)))
+
+(defcommand compile-c-files svr4-gcc-sun-ld
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "gcc" "-O2" "-c" ; "-Wall"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand link-c-program svr4-gcc-sun-ld
+ (lambda (oname objects libs parms)
+ (batch:rename-file parms
+ oname (string-append oname "~"))
+ (and (batch:try-command parms
+ "gcc" "-o" oname
+ (must-be-first
+ '("-nostartfiles"
+ "pre-crt0.o" "ecrt0.o"
+ "/usr/lib/crt0.o")
+ (append objects libs)))
+ oname)))
+
+(defcommand compile-c-files svr4
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "cc" "-O" "-DSVR4" "-c"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+
+(defcommand compile-c-files aix
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "cc" "-O" "-Dunix" "-c"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand link-c-program aix
+ (lambda (oname objects libs parms)
+ (and (batch:try-command
+ parms "cc" "-lansi" "-o" oname objects libs)
+ oname)))
+
+(defcommand compile-c-files amiga-aztec
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "cc" "-dAMIGA"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand link-c-program amiga-aztec
+ (lambda (oname objects libs parms)
+ (and (batch:try-command
+ parms "cc" "-o" oname objects libs "-lma")
+ oname)))
+
+(defcommand compile-c-files amiga-sas
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "lc" "-d3" "-M" "-fi" "-O"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (batch:try-command
+ parms "blink with link.amiga NODEBUG")
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand link-c-program amiga-sas
+ (lambda (oname objects libs parms)
+ (define lnk-name "link.amiga")
+ (apply batch:lines->file parms
+ lnk-name
+ (apply string-join "+" ">FROM LIB:c.o"
+ (map object->string objects))
+ (string-append
+ "TO " (object->string (string-append "/" oname)))
+ (append
+ (cond
+ ((pair? libs)
+ (cons (string-append "LIB LIB:" (car libs))
+ (map (lambda (s)
+ (string-append " LIB:" s))
+ (cdr libs))))
+ (else '()))
+ '("VERBOSE" "SC" "SD")))
+ oname))
+
+(defcommand compile-c-files amiga-dice-c
+ (lambda (files parms)
+ (and (batch:try-command
+ parms
+ "dcc" "-r" "-gs" "-c"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files "-o" (truncate-up-to (map c->o files) #\/))
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand link-c-program amiga-dice-c
+ (lambda (oname objects libs parms)
+ (and (batch:try-command
+ parms "dcc" "-r" "-gs" "-o" oname objects libs)
+ oname)))
+
+(defcommand compile-c-files amiga-gcc
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "gcc" "-Wall" "-O2" "-c"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand link-c-program amiga-gcc
+ (lambda (oname objects libs parms)
+ (batch:rename-file parms
+ oname (string-append oname "~"))
+ (and (batch:try-command parms
+ "gcc" "-o" oname
+ (must-be-first
+ '("-nostartfiles"
+ "pre-crt0.o" "ecrt0.o"
+ "/usr/lib/crt0.o")
+ (append objects libs)))
+ oname)))
+
+(defcommand compile-c-files atari-st-gcc
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "gcc" "-v" "-O" "-c"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand link-c-program atari-st-gcc
+ (lambda (oname objects libs parms)
+ (and (batch:try-command
+ parms "gcc" "-v" "-o" (string-append oname ".ttp")
+ objects libs)
+ (string-append oname ".ttp"))))
+
+(defcommand compile-c-files atari-st-turbo-c
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "tcc" "-P" "-W-" "-Datarist"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand link-c-program atari-st-turbo-c
+ (lambda (oname objects libs parms)
+ (and (batch:try-command
+ parms "tlink" "-o" (string-append oname ".ttp")
+ objects libs "mintlib.lib" "osbind.lib"
+ "pcstdlib.lib" "pcfltlib.lib")
+ (string-append oname ".ttp"))))
+
+(defcommand compile-c-files acorn-unixlib
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "cc" "-c" "-depend" "!Depend" "-IUnixLib:"
+ "-pcc" "-Dunix" "-DSVR3" "-DARM_ULIB"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand link-c-program acorn-unixlib
+ (lambda (oname objects libs parms)
+ (and (batch:try-command
+ parms "link" "-o" oname objects libs
+ ":5.$.dev.gcc.unixlib36d.clib.o.unixlib")
+ (batch:try-command parms "squeeze" oname)
+ oname)))
+
+(defcommand compile-c-files vms
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "cc"
+ (c-includes parms)
+ (c-flags parms)
+ (map c-> files))
+ (truncate-up-to (map c->obj files) "/]"))))
+(defcommand link-c-program vms
+ (lambda (oname objects libs parms)
+ (let ((exe (truncate-up-to (obj->exe (car objects)) "/]"))
+ (oexe (string-append oname ".exe")))
+ (and (batch:try-command parms "macro" "setjump")
+ (batch:try-command
+ parms
+ "link"
+ (apply string-join ","
+ (append (map obj-> objects)
+ '("setjump" "sys$input/opt\n ")))
+ (apply string-join
+ "," (append (remove "" libs)
+ '("sys$share:vaxcrtl/share"))))
+ (or (string-ci=? exe oexe)
+ (batch:rename-file parms exe oexe))
+ oexe))))
+
+(defcommand compile-c-files vms-gcc
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "gcc"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ (map c-> files))
+ (truncate-up-to (map c->obj files) "/]"))))
+(defcommand link-c-program vms-gcc
+ (lambda (oname objects libs parms)
+ (let ((exe (truncate-up-to (obj->exe (car objects)) "/]"))
+ (oexe (string-append oname ".exe")))
+ (and (batch:try-command parms "macro" "setjump")
+ (batch:try-command
+ parms
+ "link"
+ (apply string-join ","
+ (append objects
+ '("setjump.obj"
+ "sys$input/opt\n ")))
+ (apply string-join
+ "," (append (remove "" libs)
+ '("gnu_cc:[000000]gcclib/lib"
+ "sys$share:vaxcrtl/share"))))
+ (or (string-ci=? exe oexe)
+ (batch:rename-file parms exe oexe))
+ oexe))))
+
+(defcommand compile-c-files *unknown*
+ (lambda (files parms)
+ (batch:try-chopped-command
+ parms
+ "cc" "-O" "-c"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) "\\/]")))
+(defcommand link-c-program *unknown*
+ (lambda (oname objects libs parms)
+ (batch:rename-file parms
+ oname (string-append oname "~"))
+ (and (batch:try-command parms
+ "cc" "-o" oname
+ (must-be-first
+ '("-nostartfiles"
+ "pre-crt0.o" "ecrt0.o"
+ "/usr/lib/crt0.o")
+ (append objects libs)))
+ oname)))
+(defcommand make-archive *unknown*
+ (lambda (oname objects libs parms)
+ (let ((aname (string-append "lib" oname ".a")))
+ (and (batch:try-command parms "ar rc" aname objects)
+ (batch:try-command parms "ranlib" aname)
+ aname))))
+(defcommand compile-dll-c-files *unknown*
+ (lambda (files parms)
+ (and (batch:try-chopped-command parms
+ "cc" "-O" "-c"
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) "\\/]"))))
+(defcommand make-dll-archive *unknown*
+ (lambda (oname objects libs parms)
+ (let ((aname
+ (string-append
+ (car (parameter-list-ref parms 'implvic))
+ oname ".a")))
+ (and (batch:try-command parms "ar rc" aname objects)
+ (batch:try-command parms "ranlib" aname)
+ (batch:rebuild-catalog parms)
+ aname))))
+
+(defcommand compile-c-files freebsd
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "cc" "-O" "-c"
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (map c->o files))))
+(defcommand link-c-program freebsd
+ (lambda (oname objects libs parms)
+ (batch:rename-file parms
+ oname (string-append oname "~"))
+ (and (batch:try-command parms
+ "cc" "-o" oname
+ (must-be-first
+ '("-nostartfiles"
+ "pre-crt0.o" "crt0.o"
+ "/usr/lib/crt0.o")
+ (append objects libs)))
+ oname)))
+(defcommand compile-dll-c-files freebsd
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "cc" "-O" "-fpic" "-c"
+ (string-append
+ "-I" (parameter-list-ref parms 'scm-srcdir))
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (let ((objs (map c->o files)))
+ (every
+ (lambda (f)
+ (and (batch:try-command
+ parms "ld" "-Bshareable" f)
+ (batch:try-command
+ parms "mv" "a.out" f)))
+ objs)
+ objs))))
+
+(defcommand make-dll-archive freebsd
+ (lambda (oname objects libs parms)
+ (and (batch:try-command
+ parms
+ "ld" "-Bshareable" "-o"
+ (string-append
+ (car (parameter-list-ref parms 'implvic))
+ oname ".so")
+ objects)
+ (batch:rebuild-catalog parms)
+ (string-append
+ (car (parameter-list-ref parms 'implvic))
+ oname ".so"))))
(for-each (build 'add-domain)
- '((features features #f symbol #f)
- (C-libraries C-libraries #f symbol #f)))
+ '((C-libraries C-libraries #f symbol #f)))
(define-tables build
@@ -1501,14 +1548,18 @@ CHEAP_CONTINUATIONS.")
(string-append c "();"))
(parameter-list-ref parms 'compiled-init))))
(implvic (let ((impl (car (parameter-list-ref parms 'implvic))))
- (if (equal? "" impl)
- (car (parameter-list-ref parms 'scm-srcdir))
- impl)))
+ (if (equal? "" impl)
+ (car (parameter-list-ref parms 'scm-srcdir))
+ impl)))
(c-defines
`((define "IMPLINIT"
,(object->string
(string-append
- implvic "Init" (read-version parms) ".scm")))
+ implvic "Init"
+ (read-version
+ (in-vicinity (car (parameter-list-ref parms 'scm-srcdir))
+ "patchlvl.h"))
+ ".scm")))
;;,@`(if (equal? "" implvic) '() (...))
,@(if (string=? "" init=) '()
`((define "INITS" ,init=)))
@@ -1547,45 +1598,55 @@ CHEAP_CONTINUATIONS.")
parms
name
(lambda (batch-port)
- (define o-files '())
+ (define o-files #f)
(adjoin-parameters!
parms
(list 'batch-port batch-port))
- ;; ================ Write file with C defines
- (apply batch:lines->file parms
- "scmflags.h"
- (defines->c-defines c-defines))
-
- ;; ================ Compile C source files
- (set! o-files
- (let ((suppressors
- (apply append
- (map (lambda (l) (build:c-suppress l platform))
- (parameter-list-ref parms 'c-lib))))
- (ssdir (car (parameter-list-ref parms 'scm-srcdir))))
- (c-proc
- (map (lambda (file) (in-vicinity ssdir file))
- (apply
- append
- (remove-if (lambda (file) (member file suppressors))
- (parameter-list-ref parms 'c-file))
- (map
- (lambda (l) (build:c-lib-support l platform))
- (parameter-list-ref parms 'c-lib))))
- parms)))
-
- ;; ================ Link C object files
- ((plan-command
- ((((rdb 'open-table) 'build-whats #f) 'get 'o-proc) what)
- platform)
- (car (parameter-list-ref parms 'target-name))
- (append o-files (parameter-list-ref parms 'o-file))
- (append
- (parameter-list-ref parms 'linker-options)
- (map (lambda (l) (build:lib-ld-flag l platform))
- (parameter-list-ref parms 'c-lib)))
- parms)))))))
+ (batch:comment parms "================ Write file with C defines")
+ (cond
+ ((not (apply batch:lines->file parms
+ "scmflags.h"
+ (defines->c-defines c-defines)))
+ (batch:comment parms "================ Write failed!") #f)
+ (else
+ (batch:comment parms "================ Compile C source files")
+ (set! o-files
+ (let ((suppressors
+ (apply append
+ (map (lambda (l) (build:c-suppress l platform))
+ (parameter-list-ref parms 'c-lib))))
+ (ssdir (car (parameter-list-ref parms 'scm-srcdir))))
+ (c-proc
+ (map (lambda (file) (in-vicinity ssdir file))
+ (apply
+ append
+ (remove-if (lambda (file) (member file suppressors))
+ (parameter-list-ref parms 'c-file))
+ (map
+ (lambda (l) (build:c-lib-support l platform))
+ (parameter-list-ref parms 'c-lib))))
+ parms)))
+ (cond
+ ((not o-files)
+ (batch:comment parms "================ Compilation failed!") #f)
+ (else
+
+ (batch:comment parms "================ Link C object files")
+ (let ((ans
+ ((plan-command
+ ((((rdb 'open-table) 'build-whats #f) 'get 'o-proc) what)
+ platform)
+ (car (parameter-list-ref parms 'target-name))
+ (append o-files (parameter-list-ref parms 'o-file))
+ (append
+ (parameter-list-ref parms 'linker-options)
+ (map (lambda (l) (build:lib-ld-flag l platform))
+ (parameter-list-ref parms 'c-lib)))
+ parms)))
+ (cond ((not ans)
+ (batch:comment parms "================ Link failed!") #f)
+ (else ans)))))))))))))
(define (include-spec str parms)
(let ((path (car (parameter-list-ref parms 'scm-srcdir))))
@@ -1615,23 +1676,30 @@ CHEAP_CONTINUATIONS.")
(else (string-append "-D" (cadr d) "=" (object->string (caddr d))))))
defines))
-(define (batch:chop-to-fit-system . args)
- (apply batch:apply-chop-to-fit
- batch:try-system
- args))
+(define c-> (filename:substitute?? "*.c" "*"))
+(define c->o (filename:substitute?? "*.c" "*.o"))
+(define c->obj (filename:substitute?? "*.c" "*.obj"))
+(define obj-> (filename:substitute?? "*.obj" "*"))
+(define obj->exe (filename:substitute?? "*.obj" "*.exe"))
-(define (read-version parms)
+(define (read-version revfile)
(call-with-input-file
- (string-append (car (parameter-list-ref parms 'scm-srcdir)) "patchlvl.h")
+ (if (file-exists? revfile)
+ revfile
+ (in-vicinity (implementation-vicinity) "patchlvl.h"))
(lambda (port)
(do ((c (read-char port) (read-char port)))
((or (eof-object? c) (eqv? #\= c))
- (symbol->string (read port)))))))
+ (do ((c (read-char port) (read-char port))
+ (lst '() (cons c lst)))
+ ((or (eof-object? c) (char-whitespace? c))
+ (list->string (reverse lst)))))))))
(define (batch:rebuild-catalog parms)
(batch:delete-file parms
(in-vicinity (car (parameter-list-ref parms 'implvic))
- "slibcat")))
+ "slibcat"))
+ #t)
(define build:initializer
(lambda (rdb)