mescc: Use basename of input as default output name.
* module/mescc/mescc.scm (mescc:preprocess, mescc:compile, mescc:assemble, M1->hex2): Use basename of input as default output name.
This commit is contained in:
parent
479bf10878
commit
6541ec8c09
|
@ -44,9 +44,10 @@
|
||||||
(pretty-print/write (if (eq? pretty-print/write 'pretty-print) pretty-print write))
|
(pretty-print/write (if (eq? pretty-print/write 'pretty-print) pretty-print write))
|
||||||
(files (option-ref options '() '("a.c")))
|
(files (option-ref options '() '("a.c")))
|
||||||
(input-file-name (car files))
|
(input-file-name (car files))
|
||||||
|
(input-base (basename input-file-name))
|
||||||
(ast-file-name (cond ((and (option-ref options 'preprocess #f)
|
(ast-file-name (cond ((and (option-ref options 'preprocess #f)
|
||||||
(option-ref options 'output #f)))
|
(option-ref options 'output #f)))
|
||||||
(else (replace-suffix input-file-name ".E"))))
|
(else (replace-suffix input-base ".E"))))
|
||||||
(dir (dirname input-file-name))
|
(dir (dirname input-file-name))
|
||||||
(defines (reverse (filter-map (multi-opt 'define) options)))
|
(defines (reverse (filter-map (multi-opt 'define) options)))
|
||||||
(includes (reverse (filter-map (multi-opt 'include) options)))
|
(includes (reverse (filter-map (multi-opt 'include) options)))
|
||||||
|
@ -65,9 +66,10 @@
|
||||||
(define (mescc:compile options)
|
(define (mescc:compile options)
|
||||||
(let* ((files (option-ref options '() '("a.c")))
|
(let* ((files (option-ref options '() '("a.c")))
|
||||||
(input-file-name (car files))
|
(input-file-name (car files))
|
||||||
|
(input-base (basename input-file-name))
|
||||||
(M1-file-name (cond ((and (option-ref options 'compile #f)
|
(M1-file-name (cond ((and (option-ref options 'compile #f)
|
||||||
(option-ref options 'output #f)))
|
(option-ref options 'output #f)))
|
||||||
(else (replace-suffix input-file-name ".s"))))
|
(else (replace-suffix input-base ".s"))))
|
||||||
(infos (map (cut file->info options <>) files))
|
(infos (map (cut file->info options <>) files))
|
||||||
(verbose? (option-ref options 'verbose #f))
|
(verbose? (option-ref options 'verbose #f))
|
||||||
(align? (option-ref options 'align #f)))
|
(align? (option-ref options 'align #f)))
|
||||||
|
@ -98,9 +100,10 @@
|
||||||
(define (mescc:assemble options)
|
(define (mescc:assemble options)
|
||||||
(let* ((files (option-ref options '() '("a.c")))
|
(let* ((files (option-ref options '() '("a.c")))
|
||||||
(input-file-name (car files))
|
(input-file-name (car files))
|
||||||
|
(input-base (basename input-file-name))
|
||||||
(hex2-file-name (cond ((and (option-ref options 'assemble #f)
|
(hex2-file-name (cond ((and (option-ref options 'assemble #f)
|
||||||
(option-ref options 'output #f)))
|
(option-ref options 'output #f)))
|
||||||
(else (replace-suffix input-file-name ".o"))))
|
(else (replace-suffix input-base ".o"))))
|
||||||
(s-files (filter .s? files))
|
(s-files (filter .s? files))
|
||||||
(hex2-files M1->hex2 ) ;; FIXME
|
(hex2-files M1->hex2 ) ;; FIXME
|
||||||
(source-files (filter (disjoin .c? .E?) files))
|
(source-files (filter (disjoin .c? .E?) files))
|
||||||
|
@ -162,11 +165,12 @@
|
||||||
|
|
||||||
(define (M1->hex2 options M1-files)
|
(define (M1->hex2 options M1-files)
|
||||||
(let* ((input-file-name (car (option-ref options '() '("a.c"))))
|
(let* ((input-file-name (car (option-ref options '() '("a.c"))))
|
||||||
|
(input-base (basename input-file-name))
|
||||||
(M1-file-name (car M1-files))
|
(M1-file-name (car M1-files))
|
||||||
(hex2-file-name (cond ((and (option-ref options 'assemble #f)
|
(hex2-file-name (cond ((and (option-ref options 'assemble #f)
|
||||||
(option-ref options 'output #f)))
|
(option-ref options 'output #f)))
|
||||||
((option-ref options 'assemble #f)
|
((option-ref options 'assemble #f)
|
||||||
(replace-suffix input-file-name ".o"))
|
(replace-suffix input-base ".o"))
|
||||||
(else (replace-suffix M1-file-name ".o"))))
|
(else (replace-suffix M1-file-name ".o"))))
|
||||||
(verbose? (option-ref options 'verbose #f))
|
(verbose? (option-ref options 'verbose #f))
|
||||||
(M1 (or (getenv "M1") "M1"))
|
(M1 (or (getenv "M1") "M1"))
|
||||||
|
|
Loading…
Reference in a new issue