| 1 |
;; update.lsp -- script to push changes into source directories |
| 2 |
|
| 3 |
(load "makefile.lsp") ; just to make sure we got the latest bindings |
| 4 |
|
| 5 |
|
| 6 |
;; UPDATE-SOURCES -- makes a script to push changes into source directories |
| 7 |
;; |
| 8 |
(defun update-sources () |
| 9 |
(let (outf) |
| 10 |
(load "transfiles.lsp") ; just to make sure we're current |
| 11 |
(setf outf (open "script" :direction :output)) |
| 12 |
(format outf "# |
| 13 |
# source this script file |
| 14 |
|
| 15 |
# Source Paths: nyqsrc, cmtsrc, xlsrc, trnsrc |
| 16 |
") |
| 17 |
(format outf " |
| 18 |
# |
| 19 |
# XLISP SOURCES |
| 20 |
# |
| 21 |
") |
| 22 |
(file-update outf xlfiles ".c" "xlsrc") |
| 23 |
(file-update outf xlfiles-h ".h" "xlsrc") |
| 24 |
(file-update outf xlfiles-lsp ".lsp" "xlsrc") |
| 25 |
|
| 26 |
(format outf " |
| 27 |
# |
| 28 |
# NYQUIST SOURCES |
| 29 |
# |
| 30 |
") |
| 31 |
(file-update outf nyqfiles ".c" "nyqsrc") |
| 32 |
(file-update outf (exceptions-filter nyqfiles) ".h" "nyqsrc") |
| 33 |
(file-update outf nyqfiles-h ".h" "nyqsrc") |
| 34 |
(file-update outf nyqfiles-lsp ".lsp" "nyqsrc") |
| 35 |
(file-update outf makefiles "" "nyqsrc") |
| 36 |
|
| 37 |
(format outf " |
| 38 |
# |
| 39 |
# CMT SOURCES |
| 40 |
# |
| 41 |
") |
| 42 |
(file-update outf cmtfiles ".c" "cmtsrc") |
| 43 |
(file-update outf (exceptions-filter cmtfiles) ".h" "cmtsrc") |
| 44 |
(file-update outf cmtfiles-h ".h" "cmtsrc") |
| 45 |
|
| 46 |
; don't write back machine generated trnsrc files |
| 47 |
; (file-update outf transfiles ".c" "trnsrc") |
| 48 |
; (file-update outf transfiles ".h" "trnsrc") |
| 49 |
|
| 50 |
(close outf) |
| 51 |
|
| 52 |
(format t "DONE writing script, 'source script' to copy files from~%") |
| 53 |
(format t "this directory to the source directories~%") |
| 54 |
|
| 55 |
)) |
| 56 |
|
| 57 |
|
| 58 |
;; EXCEPTIONS-FILTER - remove .h files from list |
| 59 |
; the depends-exceptions tells whether a .h file exists for a .c file |
| 60 |
;; |
| 61 |
(defun exceptions-filter (files) |
| 62 |
(let (result) |
| 63 |
(dolist (f files) |
| 64 |
(let ((ex (assoc f depends-exceptions :test #'equal))) |
| 65 |
(cond (ex |
| 66 |
(if (and (cdr ex) |
| 67 |
(string-search (strcat f ".h") (cadr ex))) |
| 68 |
(push f result))) |
| 69 |
(t (push f result))))) |
| 70 |
result)) |
| 71 |
|
| 72 |
|
| 73 |
;; FILE-UPDATE -- write dependency for source files |
| 74 |
;; |
| 75 |
(defun file-update (outf files ext dir) |
| 76 |
(dolist (f files) |
| 77 |
(let ((fname (strcat f ext))) |
| 78 |
(format outf "cp -p ~A ~A/~A~%" fname dir fname)))) |
| 79 |
|