diff options
| author | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:25 -0800 | 
|---|---|---|
| committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:25 -0800 | 
| commit | db04688faa20f3576257c0fe41752ec435beab9a (patch) | |
| tree | 6d638c2e1f65afd5f49d20b2d22ce35bd74705ff /build.scm | |
| parent | 1edcb9b62a1a520eddae8403c19d841c9b18737f (diff) | |
| download | scm-db04688faa20f3576257c0fe41752ec435beab9a.tar.gz scm-db04688faa20f3576257c0fe41752ec435beab9a.zip  | |
Import Upstream version 5c3upstream/5c3
Diffstat (limited to 'build.scm')
| -rw-r--r--[-rwxr-xr-x] | build.scm | 1546 | 
1 files changed, 794 insertions, 752 deletions
diff --git a/build.scm b/build.scm index bf40fc2..5a13240 100755..100644 --- a/build.scm +++ b/build.scm @@ -1,18 +1,18 @@ -#!/bin/sh -:;exec ./scmlit -f $0 -e"(bi)" build $* -;;; "build.scm" Build database and program +;;; "build.scm" Build database and program	-*-scheme-*-  ;;; Copyright (C) 1994, 1995, 1996, 1997 Aubrey Jaffer.  ;;; See the file `COPYING' for terms applying to this program. -(require 'getopt)  (require 'parameters)  (require 'database-utilities)  ;;;(define build (create-database "buildscm.scm" 'alist-table))  (define build (create-database #f 'alist-table)) +(require 'glob)  (require 'batch)  (batch:initialize! build) +((((build 'open-table) 'batch-dialect #t) 'row:insert) '(default-for-platform)) +  (set! OPEN_WRITE "w")			; Because MS-DOS scripts need ^M  (define-tables build @@ -88,7 +88,7 @@       ("Init.scm"	Scheme	required	"Scheme initialization.")       ("Transcen.scm"	Scheme	required	"inexact builtin procedures.")       ("Link.scm"	Scheme	required	"compiles and dynamically links.") -     ("Macro.scm"	Scheme	required	"Supports R4RS Macros.") +     ("Macro.scm"	Scheme	required	"Supports Syntax-Rules Macros.")       ("scmfig.h"	c-header	required	"contains system dependent definitions.")       ("patchlvl.h"	c-header	required	"patchlevel of this release.")       ("setjump.h"	c-header	required	"continuations, stacks, and memory allocation.") @@ -133,7 +133,7 @@  (for-each (build 'add-domain)  	  '((optstring #f (lambda (x) (or (not x) (string? x))) string #f)  	    (filename #f #f string #f) -	    (build-whats #f #f symbol #f))) +	    (build-whats build-whats #f symbol #f)))  (define-tables build @@ -180,6 +180,7 @@       (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) @@ -210,110 +211,112 @@      ((compiler-flags string)       (link-lib-flag string)       (lib-path optstring) -     (lib-support expression)) +     (lib-support expression) +     (suppress-files expression)) -    ((m *unknown* "" "-lm" "/usr/lib/libm.a" ()) -     (c *unknown* "" "-lc" "/usr/lib/libc.a" ()) -     (regex *unknown* "" "-lregex" "/usr/lib/libregex.a" ()) -     (curses *unknown* "" "-lcurses" "/usr/lib/libcurses.a" ()) +    ((m *unknown* "" "-lm" "/usr/lib/libm.a" () ()) +     (c *unknown* "" "-lc" "/usr/lib/libc.a" () ()) +     (regex *unknown* "" "-lregex" "/usr/lib/libregex.a" () ()) +     (curses *unknown* "" "-lcurses" "/usr/lib/libcurses.a" () ())       (graphics *unknown* "-I/usr/X11/include -DX11" "-lX11" -	       "/usr/X11/lib/libX11.sa" ()) -     (editline *unknown* "" "-lreadline" "/usr/lib/libreadline.a" ()) -     (termcap *unknown* "" "-ltermcap" "/usr/lib/libtermcap.a" ()) -     (debug *unknown* "-g" "-g" #f ()) -     (socket *unknown* "" "" #f ()) - -     (m linux-aout "" "-lm" "/usr/lib/libm.sa" ()) -     (c linux-aout "" "-lc" "/usr/lib/libc.sa" ()) -     (dlll linux-aout "-DDLD -DDLD_DYNCM" "-ldld" #f ("findexec.c")) -     (regex linux-aout "" "" "" ()) +	       "/usr/X11/lib/libX11.sa" () ()) +     (editline *unknown* "" "-lreadline" "/usr/lib/libreadline.a" () ()) +     (termcap *unknown* "" "-ltermcap" "/usr/lib/libtermcap.a" () ()) +     (debug *unknown* "-g" "-g" #f () ()) +     (socket *unknown* "" "" #f () ()) + +     (c cygwin32 "" "" "" () ()) +     (m linux-aout "" "-lm" "/usr/lib/libm.sa" () ()) +     (c linux-aout "" "-lc" "/usr/lib/libc.sa" () ()) +     (dlll linux-aout "-DDLD -DDLD_DYNCM" "-ldld" #f () ("findexec.c")) +     (regex linux-aout "" "" "" () ())       (curses linux-aout "-I/usr/include/ncurses" "-lncurses" -	     "/usr/lib/libncurses.a" ()) -     (nostart linux-aout "" "-nostartfiles" #f ("pre-crt0.c")) -     (dump linux-aout "" "/usr/lib/crt0.o" #f ("unexec.c" "gmalloc.c")) +	     "/usr/lib/libncurses.a" () ()) +     (nostart linux-aout "" "-nostartfiles" #f ("pre-crt0.c") ()) +     (dump linux-aout "" "/usr/lib/crt0.o" #f ("unexec.c" "gmalloc.c") ()) -     (m linux "" "-lm" "/lib/libm.so" ()) -     (c linux "" "-lc" "/lib/libc.so" ()) -     (dlll linux "-DSUN_DL" "-ldl" #f ()) +     (m linux "" "-lm" "/lib/libm.so" () ()) +     (c linux "" "-lc" "/lib/libc.so" () ()) +     (dlll linux "-DSUN_DL" "-ldl" #f () ())       (graphics linux "-I/usr/include/X11 -DX11" "-L/usr/X11R6/lib -lX11" -	       "/usr/X11R6/lib/libX11.so" ()) -     (curses linux "" "-lcurses" "/lib/libncurses.so" ()) -     (nostart linux "" "" #f ()) -     (dump linux "" "" #f ("unexelf.c" "gmalloc.c")) +	       "/usr/X11R6/lib/libX11.so" () ()) +     (curses linux "" "-lcurses" "/lib/libncurses.so" () ()) +     (nostart linux "" "" #f () ()) +     (dump linux "" "" #f ("unexelf.c" "gmalloc.c") ()) -     (m acorn-unixlib "" "" #f ()) +     (m acorn-unixlib "" "" #f () ()) -     (nostart alpha "" "-non_shared" #f ("pre-crt0.c")) -     (dump alpha "" "" #f ("unexalpha.c")) +     (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-dice-c "" "-lm" #f () ()) +     (m amiga-SAS/C-5.10 "" "lcmieee.lib" #f () ()) +     (c amiga-SAS/C-5.10 "" "lc.lib" #f () ()) -     (m vms-gcc "" "" #f ()) -     (m vms "" "" #f ()) +     (m vms-gcc "" "" #f () ()) +     (m vms "" "" #f () ()) -     (m atari-st-gcc "" "-lpml" #f ()) -     (m atari-st-turbo-c "" "" #f ()) +     (m atari-st-gcc "" "-lpml" #f () ()) +     (m atari-st-turbo-c "" "" #f () ()) -     (m sunos "" "-lm" #f ()) -     (dlll sunos "-DSUN_DL" "-ldl" #f ()) -     (nostart sunos "" "-e __start -nostartfiles -static" #f ("ecrt0.c")) -     (dump sunos "" "" #f ("unexelf.c" "gmalloc.c")) +     (m sunos "" "-lm" #f () ()) +     (dlll sunos "-DSUN_DL" "-ldl" #f () ()) +     (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 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 () ()) -     (nostart gcc "" "-e __start -nostartfiles" #f ("ecrt0.c")) -     (dump gcc "" "" #f ("unexelf.c" "gmalloc.c")) +     (nostart gcc "" "-e __start -nostartfiles" #f ("ecrt0.c") ()) +     (dump gcc "" "" #f ("unexelf.c" "gmalloc.c") ()) -     (m hp-ux "" "-lm" #f ()) -     (dlll hp-ux "-DHAVE_DYNL" "-Wl,-E -ldld" #f ()) -     (graphics hp-ux "-DX11" "-lX" "/usr/lib/X11R5/libX11.sl" ()) -     (nostart hp-ux "" "" #f ("ecrt0.c")) -     (dump hp-ux "" "" #f ("unexhp9k800.c" "gmalloc.c")) +     (m hp-ux "" "-lm" #f () ()) +     (dlll hp-ux "-DHAVE_DYNL" "-Wl,-E -ldld" #f () ()) +     (graphics hp-ux "-DX11" "-lX" "/usr/lib/X11R5/libX11.sl" () ()) +     (nostart hp-ux "" "" #f ("ecrt0.c") ()) +     (dump hp-ux "" "" #f ("unexhp9k800.c" "gmalloc.c") ()) -     (c djgpp "" "-lc" #f ("findexec.c")) +     (c djgpp "" "-lc" #f () ("findexec.c"))       (curses djgpp "-I/djgpp/contrib/pdcurses/include/"  	     "-L/djgpp/contrib/pdcurses/lib/ -lcurses" -	     "\\djgpp\\contrib\\pdcurses\\lib\\libcurse.a" ()) -     (nostart djgpp "" "-nostartfiles" #f ("pre-crt0.c")) -     (dump djgpp "" "c:/djgpp/lib/crt0.o" #f ("unexec.c" "gmalloc.c")) -;;;     (nostart djgpp "" "" #f ("ecrt0.c")) -;;;     (dump djgpp "" "" #f ("unexelf.c" "gmalloc.c")) -;;;     (nostart djgpp "" "-e __start -nostartfiles -static" #f ("ecrt0.c")) -;;;     (dump djgpp "" "" #f ("unexelf.c" "gmalloc.c")) - -     (c Microsoft-C "" "" #f ("findexec.c")) -     (m Microsoft-C "" "" #f ()) -     (c Microsoft-C-nt "" "" #f ("findexec.c")) -     (m Microsoft-C-nt "" "" #f ()) -     (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 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 highc.31 "" "" #f ("findexec.c")) -     (m highc.31 "" "" #f ()) -     (windows highc.31 "-Hwin" "-Hwin" #f ()) - -     (m freebsd "" "-lm" #f ()) -     (regex freebsd "" "-lgnuregex" "" ()) -     (editline freebsd "" "-lreadline" "" ()) -     (dlll freebsd "-DSUN_DL" "" "" ()) -     (nostart freebsd "" "-e start -dc -dp -Bstatic -lgnumalloc" #f ("pre-crt0.c")) -     (dump freebsd "" "/usr/lib/crt0.o" "" ("unexsunos4.c")) +	     "\\djgpp\\contrib\\pdcurses\\lib\\libcurse.a" () ()) +     (nostart djgpp "" "-nostartfiles" #f ("pre-crt0.c") ()) +     (dump djgpp "" "c:/djgpp/lib/crt0.o" #f ("unexec.c" "gmalloc.c") ()) +;;;     (nostart djgpp "" "" #f ("ecrt0.c") ()) +;;;     (dump djgpp "" "" #f ("unexelf.c" "gmalloc.c") ()) +;;;     (nostart djgpp "" "-e __start -nostartfiles -static" #f ("ecrt0.c") ()) +;;;     (dump djgpp "" "" #f ("unexelf.c" "gmalloc.c") ()) + +     (c Microsoft-C "" "" #f () ("findexec.c")) +     (m Microsoft-C "" "" #f () ()) +     (c Microsoft-C-nt "" "" #f () ("findexec.c")) +     (m Microsoft-C-nt "" "" #f () ()) +     (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 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 highc.31 "" "" #f () ("findexec.c")) +     (m highc.31 "" "" #f () ()) +     (windows highc.31 "-Hwin" "-Hwin" #f () ()) + +     (m freebsd "" "-lm" #f () ()) +     (regex freebsd "" "-lgnuregex" "" () ()) +     (editline freebsd "" "-lreadline" "" () ()) +     (dlll freebsd "-DSUN_DL" "" "" () ()) +     (nostart freebsd "" "-e start -dc -dp -Bstatic -lgnumalloc" #f ("pre-crt0.c") ()) +     (dump freebsd "" "/usr/lib/crt0.o" "" ("unexsunos4.c") ())       ))    '(compile-commands @@ -325,125 +328,124 @@  		      (lambda (files parms)  			(define rsp-name "temp.rsp")  			(apply batch:lines->file parms rsp-name files) -			(batch: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") -			 #\\))) +			(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)) -		       (batch:system parms "bcc" -				     (string-append "-e" oname) -				     "-ml" -				     (string-append "@" lnk-name)) -		       (string-append oname ".exe"))) +		       (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) -			(batch: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") -			 #\\))) +			(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"))) -			 (if (not (string-ci=? exe oexe)) -			     (batch:delete-file parms oexe)) -			 (batch:system parms -				       "tcc" "-Lc:\\turboc\\lib" libs objects) -			 (if (not (string-ci=? exe oexe)) -			     (batch:rename-file parms exe oexe)) -			 oexe))) +			 (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) -			(batch: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") -			 #\\))) +			(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"))) -			 (if (not (string-ci=? exe oexe)) -			     (batch:delete-file parms oexe)) -			 (batch:system parms -				       "link" "/noe" "/ST:40000" -				       (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))) +			 (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) -			(batch: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") -			 #\\))) +			(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  		     (lambda (oname objects libs parms)  		       (let ((exe (truncate-up-to  				   (replace-suffix (car objects) ".obj" ".exe")  				   #\\))  			     (oexe (string-append oname ".exe"))) -;			 (if (not (string-ci=? exe oexe)) -;			     (batch:delete-file parms oexe)) -			 (batch:system parms -				       "link" "/nologo" (string-append "/out:" oexe) -				       (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))) +			 (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) -			(batch:system parms -				      "qcl" "/AH" "/W1" "/Ze" "/O" "/Ot" "/DNDEBUG" -				      (c-includes parms) -				      (c-flags parms) -				      files) -			(truncate-up-to -			 (replace-suffix files ".c" ".obj") -			 #\\))) +			(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")) @@ -455,400 +457,445 @@  				,(string-append oname ".exe")  				,(apply string-join " " libs)  				";")) -		       (batch:system parms -				     "qlink" -				     "/CP:0xffff" "/NOI" "/SE:0x80" "/ST:0x9c40" -				     crf-name) -		       (string-append oname ".exe"))) +		       (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) -			(batch: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") -			 #\\))) +			(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") +						   ".obj" ".exe")  				   #\\))  			     (oexe (string-append oname ".exe"))) -			 (if (not (string-ci=? exe oexe)) -			     (batch:delete-file parms oexe)) -			 (batch: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))) +			 (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) -			(batch: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") -			 #\\))) +			(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)) -			 (batch:system parms -				       "d:\\hi_c\\hc386.31\\bin\\hc386" "-o" oname -				       (string-append "@" lnk-name)) -			 (batch:system parms -				       "bind386" "d:/hi_c/pharlap.51/run386b.exe" oname -				       "-exe" oexe) -			 oexe))) +			 (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) -			(batch:apply-chop-to-fit -			 batch:try-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") -			 "\\/"))) +			(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"))) -			 (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) -			    (batch:apply-chop-to-fit -			     batch:try-system parms -			     "ar" "r" arname objects) -			    (and -			     (batch: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))) -			  (slib:error 'build "couldn't build archive")) -			 (batch:system parms "strip" exe) -			 (batch:delete-file parms oname) -			 ;;(batch:delete-file parms exe) -			 ;;(batch:system parms "coff2exe" "-s" "c:\\djgpp\\bin\\go32.exe" 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) -			(batch: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") -			 #\\))) +			(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) -		       (batch:system parms -				     "gcc" "-o" (string-append oname ".exe") -				     objects libs) -		       (string-append oname ".exe"))) +		       (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) -			(batch: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") -			 #\\))) +			(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) -		       (batch:system parms -				     "link386.exe" objects libs -				     (string-append "," oname ".exe,,,;")) -		       (string-append oname ".exe"))) +		       (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) -			(batch:system parms -				      "cc" "+O1" "-c" -				      (include-spec "-I" parms) -				      (c-includes parms) -				      (c-flags parms) -				      files) -			(truncate-up-to -			 (replace-suffix files ".c" ".o") -			 #\/))) +			(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) -			    (batch:system parms -					  "cc" "+O1" "-Wl,-E" "+z" "-c" -					  (c-includes parms) -					  (c-flags parms) -					  files) -			    (map -			     (lambda (fname) -			       (batch:rename-file parms -						  (string-append fname ".sl") -						  (string-append fname ".sl~")) -			       (batch:system parms -					     "ld" "-b" "-o" -					     (string-append fname ".sl") -					     (string-append fname ".o")) -			       (string-append fname ".sl")) -			     (truncate-up-to -			      (replace-suffix files ".c" "") -			      #\/)))) -;     (make-dll-archive HP-UX +			    (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))))) +;    (make-dll-archive HP-UX  ;		       (lambda (oname objects libs parms) -;			 (batch:system parms -;				       "ld" "-b" "-o" (string-append oname ".sl") -;				       objects) -;			 (rebuild-catalog) -;			 (string-append oname ".sl"))) - +;			 (and (batch:try-system +;			       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) -			 (batch:system parms -				       "ld" "-assert" "pure-text" "-o" -				       (string-append oname ".so.1.0") -				       objects) -			 (rebuild-catalog) -			 (string-append oname ".so.1.0"))) +			 (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) -			(batch: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") -			 #\/))) +			(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) -			    (batch:system parms -					  "gcc" "-Wall" "-O2" "-c" -					  (c-includes parms) -					  (c-flags parms) -					  files) -			    (truncate-up-to -			     (replace-suffix files ".c" ".o") -			     #\/))) +			    (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") +				  #\/))))  ;;;     (make-dll-archive linux-aout  ;;;		       (lambda (oname objects libs parms) #t -;;;			       (rebuild-catalog) +;;;			       (batch:rebuild-catalog parms)  ;;;			       oname))       (compile-c-files linux  		      (lambda (files parms) -			(batch:system parms -				      "gcc" "-O2" "-c" (c-includes parms) -				      (include-spec "-I" parms) -				      (c-flags parms) -				      files) -			(truncate-up-to -			 (replace-suffix files ".c" ".o") -			 #\/))) +			(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) -			    (batch: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)))) -			      (map -			       (lambda (fname) -				 (batch: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 +			     (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)))) -			   (batch:system -			    parms -			    "gcc" "-shared" "-o" -			    (string-append oname ".so") -			    objects -			    (map (lambda (l) (build:lib-ld-flag l platform)) -				 (parameter-list-ref parms 'c-lib)))) -			 (rebuild-catalog) -			 (string-append oname ".so"))) +			   (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) -		       (batch:system parms -				     "gcc" "-rdynamic" "-o" oname -				     (must-be-first -				      '("pre-crt0.o" "ecrt0.o" "/usr/lib/crt0.o") -				      (append objects libs))) -		       oname)) +		       (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) -			(batch: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 +			(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) -		       (batch:system parms -				     "cc" "setjump.o" "-o" oname objects libs) -		       oname)) +		       (and (batch:try-system +			     parms "cc" "setjump.o" "-o" oname objects libs) +			    oname)))       (compile-c-files gcc  		      (lambda (files parms) -			(batch: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") -			 #\/))) +			(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 "~")) -		       (batch:system parms -				     "gcc" "-o" oname -				     (must-be-first -				      '("-nostartfiles" -					"pre-crt0.o" "ecrt0.o" -					"/usr/lib/crt0.o") -				      (append objects libs))) -		       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) -			(batch: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") -			 #\/))) +			(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 "~")) -		       (batch:system parms -				     "gcc" "-o" oname -				     (must-be-first -				      '("-nostartfiles" -					"pre-crt0.o" "ecrt0.o" -					"/usr/lib/crt0.o") -				      (append objects libs))) -		       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) -			(batch: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") -			 #\/))) +			(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) -			(batch: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") -			 #\/))) +			(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) -		       (batch:system parms -				     "cc" "-lansi" "-o" oname objects libs) -		       oname)) +		       (and (batch:try-system +			     parms "cc" "-lansi" "-o" oname objects libs) +			    oname)))       (compile-c-files amiga-aztec  		      (lambda (files parms) -			(batch:system parms -				      "cc" "-dAMIGA" -				      (include-spec "-I" parms) -				      (c-includes parms) -				      (c-flags parms) -				      files) -			(truncate-up-to -			 (replace-suffix files ".c" ".o") -			 #\/))) +			(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) -		       (batch:system parms -				     "cc" "-o" oname objects libs "-lma") -		       oname)) +		       (and (batch:try-system +			     parms "cc" "-o" oname objects libs "-lma") +			    oname)))       (compile-c-files amiga-SAS/C-5.10  		      (lambda (files parms) -			(batch:system parms -				      "lc" "-d3" "-M" "-fi" "-O" -				      (include-spec "-I" parms) -				      (c-includes parms) -				      (c-flags parms) -				      files) -			(batch:system parms "blink with link.amiga NODEBUG") -			(truncate-up-to -			 (replace-suffix files ".c" ".o") -			 #\/))) +			(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") @@ -871,156 +918,158 @@       (compile-c-files amiga-dice-c  		      (lambda (files parms) -			(batch: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") -			 #\/))) +			(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) -		       (batch:system parms -				     "dcc" "-r" "-gs" "-o" oname objects libs) -		       oname)) +		       (and (batch:try-system +			     parms "dcc" "-r" "-gs" "-o" oname objects libs) +			    oname)))       (compile-c-files atari-st-gcc  		      (lambda (files parms) -			(batch: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") -			 #\/))) +			(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) -		       (batch:system parms -				     "gcc" "-v" "-o" (string-append oname ".ttp") -				     objects libs) -		       (string-append oname ".ttp"))) +		       (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) -			(batch: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") -			 #\/))) +			(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) -		       (batch:system parms -				     "tlink" "-o" (string-append oname ".ttp") -				     objects libs "mintlib.lib" "osbind.lib" -				     "pcstdlib.lib" "pcfltlib.lib") -		       (string-append oname ".ttp"))) +		       (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) -			(batch: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") -			 #\/))) +			(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) -		       (batch:system parms -				     "link" "-o" oname objects libs -				     ":5.$.dev.gcc.unixlib36d.clib.o.unixlib") -		       (batch:system parms -				     "squeeze" oname) -		       oname)) +		       (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) -			(batch:system parms -				      "cc" -				      (c-includes parms) -				      (c-flags parms) -				      (replace-suffix files ".c" "")) -			(truncate-up-to -			 (replace-suffix files ".c" ".obj") -			 "/]"))) +			(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") +						   ".obj" ".exe")  				   "/]"))  			     (oexe (string-append oname ".exe"))) -			 (batch:system parms -				       "macro" "setjump") -			 (batch: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")))) -			 (if (not (string-ci=? exe oexe)) -			     (batch:rename-file parms exe oexe)) -			 oexe))) +			 (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) -			(batch: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") -			 "/]"))) +			(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") +				   (replace-suffix (car objects) ".obj" ".exe")  				   "/]"))  			     (oexe (string-append oname ".exe"))) -			 (batch:system parms -				       "macro" "setjump") -			 (batch: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")))) -			 (if (not (string-ci=? exe oexe)) -			     (batch:rename-file parms exe oexe)) -			 oexe))) +			 (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:system parms -				      "cc" "-O" "-c" -				      (include-spec "-I" parms) -				      (c-includes parms) -				      (c-flags parms) -				      files) +			(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")  			 "\\/]"))) @@ -1028,89 +1077,101 @@  		     (lambda (oname objects libs parms)  		       (batch:rename-file parms  					  oname (string-append oname "~")) -		       (batch:system parms -				     "cc" "-o" oname -				     (must-be-first -				      '("-nostartfiles" -					"pre-crt0.o" "ecrt0.o" -					"/usr/lib/crt0.o") -				      (append objects libs))) -		       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"))) -		       (batch:system parms "ar rc" aname objects) -		       (batch:system parms "ranlib" aname) -		       aname))) +		       (and (batch:try-system parms "ar rc" aname objects) +			    (batch:try-system parms "ranlib" aname) +			    aname))))       (compile-dll-c-files *unknown*  			  (lambda (files parms) -			    (batch:system parms -					  "cc" "-O" "-c" -					  (c-includes parms) -					  (c-flags parms) -					  files) -			    (truncate-up-to -			     (replace-suffix files ".c" ".o") -			     "\\/]"))) +			    (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 oname ".a"))) -			   (batch:system parms -					 "ar rc" aname objects) -			   (batch:system parms -					 "ranlib" aname) -			   (rebuild-catalog) -			   aname))) +			 (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) -		       (rebuild-catalog) +		       (batch:rebuild-catalog parms)  		       (if (= 1 (length objects)) (car objects)  			   objects)))       (compile-c-files freebsd  		      (lambda (files parms) -			(batch:system parms -				      "cc" "-O" "-Dfreebsd" "-c" -				      (c-includes parms) -				      (c-flags parms) -				      files) -			(replace-suffix files ".c" ".o"))) +			(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 "~")) -		       (batch:system parms -				     "cc" "-o" oname -				     (must-be-first -				      '("-nostartfiles" -					"pre-crt0.o" "crt0.o" -					"/usr/lib/crt0.o") -				      (append objects libs))) -		       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) -			    (batch:system parms -					  "cc" "-O" "-fpic" "-c"  -					  "-Dfreebsd" -					  (string-append "-I" (implementation-vicinity)) -					  (c-includes parms) -					  (c-flags parms) -					  files) -			    (let ((objs (replace-suffix files ".c" ".o"))) -			      (map (lambda (f) -				     (batch:system parms "ld" "-Bshareable" f) -				     (batch:system parms "mv" "a.out" f)) -				   objs) -			      objs))) +			    (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) -			 (batch:system parms -				       "ld" "-Bshareable" "-o" -				       (string-append oname ".so") -				       objects) -			 (rebuild-catalog) -			 (string-append oname ".so"))) +			 (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"))))       )) @@ -1270,7 +1331,7 @@ Convert a running scheme program into an executable file.")  ;;;	(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_size/4)"))) +;;;	(minimum-gc-yield ((define "MIN_GC_YIELD" "(heap_cells/4)")))       (heap-can-shrink ((define "DONT_GC_FREE_SEGMENTS"))  		      "\ @@ -1286,7 +1347,14 @@ 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.") -     )) +     ))) + +(for-each (build 'add-domain) +	  '((features features #f symbol #f) +	    (C-libraries C-libraries #f symbol #f))) + +(define-tables build +    '(build-params      *parameter-columns*      *parameter-columns* @@ -1296,18 +1364,16 @@ CHEAP_CONTINUATIONS.")  	"what to build it for")       (2 target-name single string (lambda (pl) '("scm")) #f  	"base name of target") -     (3 c-lib nary symbol (lambda (pl) '(c)) #f +     (3 c-lib nary C-libraries (lambda (pl) '(c)) #f  	"C library (and include files)")       (4 define nary string #f #f "#define FLAG") -     (5 implinit single string -	(lambda (pl) (list (object->string -			    (in-vicinity (implementation-vicinity) "Init.scm")))) +     (5 implvic single string (lambda (pl) (list ""))  	#f "implementation vicinity")       (6 c-file nary filename #f #f "C source files")       (7 o-file nary filename #f #f "other object files")       (8 init nary string #f #f "initialization calls")       (9 compiled-init nary string #f #f "later initialization calls") -     (10 features nary symbol +     (10 features nary features  	 (lambda (pl) '(arrays inexact bignums))  	 (lambda (rdb) (((rdb 'open-table) 'features #f) 'get 'spec))  	 "features to include") @@ -1323,28 +1389,27 @@ CHEAP_CONTINUATIONS.")  		 ,@(or (getspec what) '())))))  	 "what to build")       (12 batch-dialect single batch-dialect -	 guess-how +	 (lambda (pl) '(default-for-platform)) ;;guess-how  	 #f -	 "How to build") -     (13 who single expression (lambda (pl) (list (current-output-port))) #f -	 "name of buildfile or port") +	 "scripting language") +     (13 who optional expression #f #f "name of buildfile")       (14 compiler-options nary string #f #f "command-line compiler options")       (15 linker-options nary string #f #f "command-line linker options") -     (17 batch-port nary expression #f #f -	 "port batch file will be written to.") -     (18 c-defines nary expression #f #f "#defines for C") -     (19 c-includes nary expression #f #f "library induced defines for C") -     (20 scm-srcdir single filename +     (16 scm-srcdir single filename  	 (lambda (pl) (list (user-vicinity))) #f  	 "directory path for files in the manifest") -     (21 scm-libdir single filename +     (17 scm-libdir single filename  	 (lambda (pl) (list (implementation-vicinity))) #f  	 "directory path for files in the manifest") +     (18 c-defines nary expression #f #f "#defines for C") +     (19 c-includes nary expression #f #f "library induced defines for C") +     (20 batch-port nary expression #f #f +	 "port batch file will be written to.")       ))    '(build-pnames      ((name string)) -    ((parameter-index uint)) +    ((parameter-index uint))		;should be build-params      (       ("p" 1) ("platform" 1)       ("o" 2) ("outname" 2) @@ -1360,8 +1425,8 @@ CHEAP_CONTINUATIONS.")       ("w" 13) ("script name" 13)       ("compiler options" 14)       ("linker options" 15) -     ("scm srcdir" 20) -     ("scm libdir" 21) +     ("scm srcdir" 16) +     ("scm libdir" 17)       ))    '(*commands* @@ -1374,11 +1439,11 @@ CHEAP_CONTINUATIONS.")        build-params        build-pnames        build:build -      "build program.") +      "compile and link SCM programs.")       (*initialize*        no-parameters        no-parameters -      build:init +      #f        "SCM Build Database"))))  ;;;((build 'close-database)) @@ -1389,6 +1454,7 @@ CHEAP_CONTINUATIONS.")  (define build:lib-cc-flag #f)  (define build:lib-ld-flag #f)  (define build:c-lib-support #f) +(define build:c-suppress #f)  (define plan-command #f)  ;;; Look up command on a platform, but default to '*unknown* if not @@ -1400,7 +1466,8 @@ CHEAP_CONTINUATIONS.")        (let ((ans (getter thing platform)))  	(cond (ans ans)  	      ((eq? '*unknown* platform) -	       (build:error "Couldn't find: " plat thing)) +	       ;;(slib:warn "Couldn't find: " plat thing) +	       '())  	      (else (look '*unknown*)))))      (look plat))) @@ -1433,9 +1500,16 @@ CHEAP_CONTINUATIONS.")  		   (map (lambda (c)  			  (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)))  	   (c-defines  	    `((define "IMPLINIT" -		,(car (parameter-list-ref parms 'implinit))) +		,(object->string +		  (string-append +		   implvic "Init" (read-version parms) ".scm"))) +	      ;;,@`(if (equal? "" implvic) '() (...))  	      ,@(if (string=? "" init=) '()  		    `((define "INITS" ,init=)))  	      ,@(if (string=? "" compiled-init=) '() @@ -1447,19 +1521,28 @@ CHEAP_CONTINUATIONS.")  	   (c-includes  	    (map (lambda (l) (build:lib-cc-flag l platform))  		 (parameter-list-ref parms 'c-lib))) -	   (batch-dialect (car (parameter-list-ref parms 'batch-dialect)))  	   (what (car (parameter-list-ref parms 'what)))  	   (c-proc (plan-command ((((rdb 'open-table) 'build-whats #f)  				   'get 'c-proc)  				  what)  				 platform))) + +      (case (car (parameter-list-ref parms 'batch-dialect)) +	((default-for-platform) +	 (let ((os ((((build 'open-table) 'platform #f) +		     'get 'operating-system) platform))) +	   (if (not os) +	       (build:error "OS corresponding to " platform " unknown")) +	   (adjoin-parameters! +	    parms (cons 'batch-dialect (list (os->batch-dialect os))))))) +        (adjoin-parameters!         parms         (cons 'c-defines c-defines) -       (cons 'c-includes c-includes) -       ) +       (cons 'c-includes c-includes)) -      (let ((name (car (parameter-list-ref parms 'who)))) +      (let ((name (parameter-list-ref parms 'who))) +	(set! name (if (null? name) (current-output-port) (car name)))  	(batch:call-with-output-script  	 parms  	 name @@ -1476,17 +1559,21 @@ CHEAP_CONTINUATIONS.")  	   ;; ================ Compile C source files  	   (set! o-files -		 (c-proc -		  (map (lambda (file) -			 (in-vicinity -			  (car (parameter-list-ref parms 'scm-srcdir)) -			  file)) -		       (apply append -			      (parameter-list-ref parms 'c-file) -			      (map -			       (lambda (l) (build:c-lib-support l platform)) -			       (parameter-list-ref parms 'c-lib)))) -		  parms)) +		 (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 @@ -1528,13 +1615,23 @@ CHEAP_CONTINUATIONS.")         (else (string-append "-D" (cadr d) "=" (object->string (caddr d))))))     defines)) -(define (guess-how pl) -  (let* ((plat (parameter-list-ref pl 'platform)) -	 (platform (if (pair? plat) (car plat) batch:platform))) -    (let ((os (or ((((build 'open-table) 'platform #f) -		    'get 'operating-system) platform) batch:platform))) -      (cond ((not os) (slib:error "OS corresponding to " platform " unknown")) -	    (else (list (os->batch-dialect os))))))) +(define (batch:chop-to-fit-system . args) +  (apply batch:apply-chop-to-fit +	 batch:try-system +	 args)) + +(define (read-version parms) +  (call-with-input-file +      (string-append (car (parameter-list-ref parms 'scm-srcdir)) "patchlvl.h") +    (lambda (port) +      (do ((c (read-char port) (read-char port))) +	  ((or (eof-object? c) (eqv? #\= c)) +	   (symbol->string (read port))))))) + +(define (batch:rebuild-catalog parms) +  (batch:delete-file parms +		     (in-vicinity (car (parameter-list-ref parms 'implvic)) +				  "slibcat")))  (define build:initializer    (lambda (rdb) @@ -1548,6 +1645,9 @@ CHEAP_CONTINUATIONS.")      (set! build:c-lib-support  	  (make-defaulting-platform-lookup  	   (build:c-libraries 'get 'lib-support))) +    (set! build:c-suppress +	  (make-defaulting-platform-lookup +	   (build:c-libraries 'get 'suppress-files)))      (set! plan-command  	  (let ((lookup (make-defaulting-platform-lookup  			 (((rdb 'open-table) 'compile-commands #f) @@ -1555,61 +1655,3 @@ CHEAP_CONTINUATIONS.")  	    (lambda (thing plat)  	      (slib:eval (lookup thing plat)))))))  (build:initializer build) - -(define (rebuild-catalog) -  (delete-file (in-vicinity (implementation-vicinity) "slibcat")) -  ;;(load (in-vicinity (implementation-vicinity) "mkimpcat")) -  ) - -(define (build-from-argv argv) -  (cond ((string? argv) -	 (require 'read-command) -	 (set! argv (call-with-input-string argv read-command)))) -  (let () -    (define command (string->symbol (list-ref argv *optind*))) -    (define argc (length argv)) -    (cond -     ((pair? argv) -      (set! *optind* (+ 1 *optind*)) -      ((make-command-server build '*commands*) -       command -       (lambda (comname comval options positions arities types -			defaulters checks aliases) -	 (let* ((params (getopt->parameter-list -			 argc argv options arities types aliases)) -		(fparams (fill-empty-parameters defaulters params))) -	   (cond ((not (list? params)) #f) -		 ((not (check-parameters checks fparams)) #f) -		 ((not (check-arities (map arity->arity-spec arities) fparams)) -		  (slib:error 'build-from-argv "arity error" fparams) #f) -		 (else (comval fparams)))))))))) - -(define (build-from-whole-argv argv) -  (set! *optind* 0) -  (set! *optarg* #f) -  (build-from-argv argv)) - -(define b build-from-whole-argv) - -(define (b*) -  (require 'read-command) -  (do ((e (read-command) (read-command))) -      ((eof-object? e)) -    (cond ((null? e)) -	  (else -	   (cond ((not (string-ci=? (car e) "build")) -		  (set! e (cons "build" e)))) -	   (write (build-from-whole-argv e)) -	   (newline))) -    (display "build> ") -    (force-output))) - -(define (bi) (build-from-argv *argv*)) - -(cond (*interactive* -       (display "type (b \"build <command-line>\") to build") (newline) -       (display "type (b*) to enter build command loop") (newline))) - -;;; Local Variables: -;;; mode:scheme -;;; End:  | 
