1% 2% BUILD.RED - Compile a module from .BUILD or .RED file 3% 4% Author: Eric Benson 5% Symbolic Computation Group 6% Computer Science Dept. 7% University of Utah 8% Date: 23 March 1982 9% Status: Open Source: BSD License 10% 11% (c) Copyright 1982, University of Utah 12% 13% Redistribution and use in source and binary forms, with or without 14% modification, are permitted provided that the following conditions are met: 15% 16% * Redistributions of source code must retain the relevant copyright 17% notice, this list of conditions and the following disclaimer. 18% * Redistributions in binary form must reproduce the above copyright 19% notice, this list of conditions and the following disclaimer in the 20% documentation and/or other materials provided with the distribution. 21% 22% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24% THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25% PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNERS OR 26% CONTRIBUTORS 27% BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33% POSSIBILITY OF SUCH DAMAGE. 34% 35% Edit by Russ Fish, Tue Oct 20 18:15 1987 36% Reorder the extensions list so 14-character filename Unix machines 37% don't always assume a truncated filename is a .build file. 38% Edit by Tim Mueller, Mon Nov 3 11:18:47 1986 39% Converted to lisp syntax. 40% Edit by Russ Fish, Sat Apr 14 07:37:25 1984 41% Add BuildErrorExit mode to return error status instead of ignoring it. 42% Look for other extensions: .r and .rl for rlisp, .lsp for lisp syntax. 43% Echo .build files as before, suppress echo for source files. 44% Edit by MLG, 9 April 1983 45% added MakeBuildFilename, and ERRSET, so Build more robust 46% and more like Compile-file. Also turned off break, 47% and do closing FASLEND in case of error. 48% Edit by Cris Perdue, 23 Mar 1983 0856-PST 49% Added BuildFileFormat for Apollo as requested by Kessler 50% 07-Mar-83 Nancy Kendzierski 51% Added load if-system, since many .build files use the if_system macro. 52% 09-Feb-83 MLG 53% Changed Buildformat to use $pl/ 54% <PSL.UTIL>BUILD.RED.3, 1-Dec-82 16:12:33, Edit by BENSON 55% Added if_system(HP9836, ... ) 56 57(compiletime (load if-system)) 58(imports '(if-system)) % useful for most "built" systems 59 60(fluid '(*quiet_faslout % turns off welcome message in faslout 61 *lower % lowercase ids on output 62 *usermode % query on redefinition 63 buildfileformat*)) 64 65 66(if_system tops20 67 (setq buildfileformat* "pl:%w")) 68(if_system unix 69 (setq buildfileformat* "$pl/%w")) 70(if_system hp9836 71 (setq buildfileformat* "pl:%w")) 72(if_system apollo 73 (setq buildfileformat* "~p/l/%w")) 74 75(de makebuildfilename (modulename extlist) 76% Try to construct Filename form Modulename 77 (prog (y) 78 (cond ((null extlist) (return (stderror 79 (bldmsg "Cant find a complete filename for %r" modulename))))) 80 (cond ((filep (setq y (bldmsg "%w.%w" modulename (car extlist)))) 81 (return 82 (progn 83 % Echo .build files, suppress echo for source files. 84 (setq semic* (cond ((eq (car extlist) 'build) '\;) (t '$))) 85 (errorprintf "--- Building %w%n" y) 86 y)))) 87 88 (return (makebuildfilename modulename (cdr extlist))))) 89 90 91(fluid '(*builderrorexit)) % For scripts: if on, exits with error status. 92 93(de build (x) 94 (prog (result) 95 (setq result (errset (buildaux x) t)) 96 (cond ((fixp result) 97 (progn (cond (*writingfaslfile (faslend))) 98 (errorprintf "***** Error during build of %w%n" x) 99 (cond (*builderrorexit 100 (exit-with-status (cond ((neq result 0) result) (t -1)))))))))) 101 102 103(de buildaux (x) 104(prog (*usermode *quiet_faslout y *break result) 105 (setq *quiet_faslout t) 106 ((lambda (*lower) 107 (progn (setq y (makebuildfilename x '(r rl red build sl lsp))) 108 (faslout (bldmsg buildfileformat* x)))) t) 109 (evin (list y)) % Lisp input for .SL, .LSP, otherwise Rlisp. 110 (faslend))) 111 112 113 114 115 116