From 722b6f22ef272e5b9be6ebeb9b2e0dc36f74af50 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Tue, 12 May 2015 23:00:59 -0400 Subject: [PATCH] WIP --- cyclone.scm | 17 ++++++++++------- trans.scm | 17 +++++++++++++---- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/cyclone.scm b/cyclone.scm index 455856c3..3011faba 100644 --- a/cyclone.scm +++ b/cyclone.scm @@ -228,13 +228,16 @@ ;; Compile the generated C file (if cc? - (if program? - (system - ;; -I is a hack, real answer is to use 'make install' to place .h file -;TODO: need to link to object files from lib:import->obj-file - (string-append "gcc " src-file " -L. -lcyclone -lm -I. -g -o " exec-file)) - (system - (string-append "gcc " src-file " -I. -g -c -o " exec-file ".o")))))) + (cond + (program? +; TODO: (write `(DEBUG ,(lib:imports->objs (cdar input-program) "."))) + (system + ;; -I is a hack, real answer is to use 'make install' to place .h file +;TODO: n eed to link to object files from lib:import->obj-file + (string-append "gcc " src-file " -L. -lcyclone -lm -I. -g -o " exec-file))) + (else + (system + (string-append "gcc " src-file " -I. -g -c -o " exec-file ".o"))))))) ;; Handle command line arguments diff --git a/trans.scm b/trans.scm index 1a996e97..ea0b85b5 100644 --- a/trans.scm +++ b/trans.scm @@ -1812,11 +1812,20 @@ ;; libs requires. will probably need to prune duplicates from completed list. ;; longer-term, do we want to look at file timestamps to see if files need to ;; be recompiled? -(define (lib:imports->objs imports) - (for-each +(define (lib:imports->objs imports basedir) + (map (lambda (i) - TODO) - imports) + (append (lib:imports->objs (lib:read-imports i basedir)) + (lib:import->obj-file i))) + imports)) +(define (lib:read-imports import basedir) + (let* ((dir (string-append basedir (lib:import->filename import))) + (fp (open-input-file dir)) + (lib (read-all fp)) + (imports (lib:imports (car lib)))) + (close-input-port fp) + imports)) + ;; Read export list for a given import (define (lib:import->export-list import basedir) (let* ((dir (string-append basedir (lib:import->filename import)))