Output full path to .o files

This commit is contained in:
Justin Ethier 2015-05-13 22:54:59 -04:00
parent d5982c0671
commit e43fc78ac5

View file

@ -1791,22 +1791,23 @@
(cdr code)))) (cdr code))))
;; TODO: include, include-ci, cond-expand ;; TODO: include, include-ci, cond-expand
;; Resolve library filename from an import. Assumes ".sld" extension. ;; Resolve library filename given an import.
(define (lib:import->filename import) ;; Assumes ".sld" file extension if one is not specified.
(string-append (define (lib:import->filename import . ext)
(apply (let* ((file-ext
string-append (if (null? ext)
(map ".sld"
(lambda (i) (car ext)))
(string-append "/" (symbol->string i))) (filename
import)) (string-append
".sld")) (apply
string-append
;; Resolve a single import to its corresponding object file. (map
;; EG: (libs lib2) ==> "lib2.o" (lambda (i)
(define (lib:import->obj-file import) (string-append "/" (symbol->string i)))
(string-append (symbol->string (car (reverse import))) ".o")) import))
file-ext)))
(substring filename 1 (string-length filename))))
; !!!!!!!!!!!!!!!!!!!!!!!! ; !!!!!!!!!!!!!!!!!!!!!!!!
;TODO: all this basedir stuff below is silly. all we need is a way of saying OK, this ;TODO: all this basedir stuff below is silly. all we need is a way of saying OK, this
@ -1825,7 +1826,7 @@
(map (map
(lambda (i) (lambda (i)
(cons (cons
(lib:import->obj-file i) (lib:import->filename i ".o")
(lib:imports->objs (lib:read-imports i basedir) basedir) (lib:imports->objs (lib:read-imports i basedir) basedir)
)) ))
imports))) imports)))
@ -1833,7 +1834,7 @@
;; Given a single import from an import-set, open the corresponding ;; Given a single import from an import-set, open the corresponding
;; library file and retrieve the library's import-set. ;; library file and retrieve the library's import-set.
(define (lib:read-imports import basedir) (define (lib:read-imports import basedir)
(let* ((dir (string-append basedir (lib:import->filename import))) (let* ((dir (string-append basedir "/" (lib:import->filename import)))
(fp (open-input-file dir)) (fp (open-input-file dir))
(lib (read-all fp)) (lib (read-all fp))
(imports (lib:imports (car lib)))) (imports (lib:imports (car lib))))
@ -1842,7 +1843,7 @@
;; Read export list for a given import ;; Read export list for a given import
(define (lib:import->export-list import basedir) (define (lib:import->export-list import basedir)
(let* ((dir (string-append basedir (lib:import->filename import))) (let* ((dir (string-append basedir "/" (lib:import->filename import)))
(fp (open-input-file dir)) (fp (open-input-file dir))
(lib (read-all fp)) (lib (read-all fp))
(exports (lib:exports (car lib)))) (exports (lib:exports (car lib))))