From d10a45e62d918676988f0e29e2e45ec72358d400 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Tue, 12 May 2015 22:12:06 -0400 Subject: [PATCH] WIP --- cyclone.scm | 2 +- trans.scm | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cyclone.scm b/cyclone.scm index 8a3c3f8d..455856c3 100644 --- a/cyclone.scm +++ b/cyclone.scm @@ -231,7 +231,7 @@ (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 +;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")))))) diff --git a/trans.scm b/trans.scm index ebff6a4d..1a996e97 100644 --- a/trans.scm +++ b/trans.scm @@ -1802,8 +1802,21 @@ import)) ".sld")) ;; Resolve, EG: (libs lib2) ==> lib2.o +;; Thing is though, what if a library includes another library? now the +;; program needs to link to both .o files (define (lib:import->obj-file import) - 'TODO) + (string-append (symbol->string (car (reverse import))) ".o")) + +;; TODO: for a program import set, resolve each to their .o files, then +;; process each import recursively to get the .o files that each one of those +;; 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 + (lambda (i) + TODO) + imports) ;; Read export list for a given import (define (lib:import->export-list import basedir) (let* ((dir (string-append basedir (lib:import->filename import)))