mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 08:17:35 +02:00
Preparing to use paths from makefile
This commit is contained in:
parent
03c0c81edc
commit
021d1bee0f
5 changed files with 21 additions and 45 deletions
2
TODO
2
TODO
|
@ -24,8 +24,6 @@ in addition, the chicken code can just hardwire it to the current directory or a
|
|||
|
||||
1) makefile needs to pass PREFIX when building the runtime lib
|
||||
|
||||
* purge (cyc:get-*-dir) functions
|
||||
should only need these maybe for the chicken install.
|
||||
* figure out how a build will go now. is it possible to build locally
|
||||
and test (which would be ideal) or is an install required? a
|
||||
compromise might be to require libs/includes be installed, but
|
||||
|
|
43
cyclone.scm
43
cyclone.scm
|
@ -18,35 +18,17 @@
|
|||
|
||||
(cond-expand
|
||||
(chicken
|
||||
(define (Cyc-installation-dir) "home/justin/Documents/cyclone")
|
||||
;; TODO: nuke all the other defs below, this is the only one to base installed locations on
|
||||
|
||||
;; TODO: will need to read these from env somehow.
|
||||
;; for now they are just hard-coded, but that won't work for an install
|
||||
(define (cyc:get-lib-dir) "/home/justin/Documents/cyclone/")
|
||||
(define (cyc:get-clib-dir) "/home/justin/Documents/cyclone/")
|
||||
(define (cyc:get-include-dir) "/home/justin/Documents/cyclone/")
|
||||
;; END TODO
|
||||
(define (Cyc-installation-dir) "/home/justin/Documents/cyclone")
|
||||
(require-extension extras) ;; pretty-print
|
||||
(require-extension chicken-syntax) ;; when
|
||||
(require-extension srfi-1) ;; every
|
||||
(load (string-append (cyc:get-lib-dir) "scheme/cyclone/common.so"))
|
||||
(load (string-append (cyc:get-lib-dir) "parser.so"))
|
||||
(load (string-append (cyc:get-lib-dir) "util.so"))
|
||||
(load (string-append (cyc:get-lib-dir) "libraries.so"))
|
||||
(load (string-append (cyc:get-lib-dir) "transforms.so"))
|
||||
(load (string-append (cyc:get-lib-dir) "cgen.so")))
|
||||
(load (string-append (Cyc-installation-dir) "/scheme/cyclone/common.so"))
|
||||
(load (string-append (Cyc-installation-dir) "/parser.so"))
|
||||
(load (string-append (Cyc-installation-dir) "/util.so"))
|
||||
(load (string-append (Cyc-installation-dir) "/libraries.so"))
|
||||
(load (string-append (Cyc-installation-dir) "/transforms.so"))
|
||||
(load (string-append (Cyc-installation-dir) "/cgen.so")))
|
||||
(else #f))
|
||||
;; (husk
|
||||
;; (import (husk pretty-print))
|
||||
;; ;; TODO: load files
|
||||
;; )
|
||||
; (else
|
||||
; (load (string-append (cyc:get-lib-dir) "parser.scm"))
|
||||
; (load (string-append (cyc:get-lib-dir) "util.scm"))
|
||||
; (load (string-append (cyc:get-lib-dir) "libraries.scm"))
|
||||
; (load (string-append (cyc:get-lib-dir) "transforms.scm"))
|
||||
; (load (string-append (cyc:get-lib-dir) "cgen.scm"))))
|
||||
|
||||
;; Code emission.
|
||||
|
||||
|
@ -271,7 +253,12 @@
|
|||
(result (create-c-file in-prog)))
|
||||
|
||||
;; Compile the generated C file
|
||||
(define (Cyc-installation-lib-dir) "") ; /lib/cyclone
|
||||
(define (Cyc-installation-inc-dir) "") ; /inc/cyclone
|
||||
;; TODO: -I is a hack, real answer is to use 'make install' to place .h file
|
||||
;; TODO: real answer is to get rid of -I and -L below, and assume header and libs are
|
||||
;; already installed on the system. this is OK since we are going to have a place
|
||||
;; to bootstrap cyclone from, so it will always be installed.
|
||||
(cond
|
||||
(program?
|
||||
(letrec ((objs-str
|
||||
|
@ -282,9 +269,9 @@
|
|||
(string-append " " (lib:import->filename i ".o") " "))
|
||||
lib-deps)))
|
||||
(comp-prog-cmd
|
||||
(string-append "gcc " src-file " -I" (cyc:get-include-dir) " -g -c -o " exec-file ".o"))
|
||||
(string-append "gcc " src-file " -I" (Cyc-installation-dir) (Cyc-installation-inc-dir) " -g -c -o " exec-file ".o"))
|
||||
(comp-objs-cmd
|
||||
(string-append "gcc " exec-file ".o " objs-str " -L" (cyc:get-clib-dir) " -lcyclone -lm -I" (cyc:get-include-dir) " -g -o " exec-file)))
|
||||
(string-append "gcc " exec-file ".o " objs-str " -L" (Cyc-installation-dir) (Cyc-installation-lib-dir) " -lcyclone -lm -I" (Cyc-installation-dir) (Cyc-installation-inc-dir) " -g -o " exec-file)))
|
||||
;(write `(DEBUG all imports ,lib-deps objs ,objs-str))
|
||||
;(write `(DEBUG ,(lib:get-all-import-deps (cdar in-prog))))
|
||||
(cond
|
||||
|
@ -296,7 +283,7 @@
|
|||
(write comp-objs-cmd)))))
|
||||
(else
|
||||
(let ((comp-lib-cmd
|
||||
(string-append "gcc " src-file " -I" (cyc:get-include-dir) " -g -c -o " exec-file ".o")))
|
||||
(string-append "gcc " src-file " -I" (Cyc-installation-dir) (Cyc-installation-inc-dir) " -g -c -o " exec-file ".o")))
|
||||
(cond
|
||||
(cc?
|
||||
(system comp-lib-cmd))
|
||||
|
|
|
@ -13,13 +13,6 @@
|
|||
;; not a very clean or nice API at the moment.
|
||||
;;
|
||||
|
||||
;; TODO: this definition is just temporary until we figure out how to get this info.
|
||||
;; this is problematic as it has to work for the bootstrap and the actual cyclone comp.
|
||||
;; although I suppose it would be OK if you have to bootstrap from a hardcoded dir
|
||||
(define (cyc:get-lib-dir) "/home/justin/Documents/cyclone/")
|
||||
(define (cyc:get-clib-dir) "/home/justin/Documents/cyclone/")
|
||||
(define (cyc:get-include-dir) "/home/justin/Documents/cyclone/")
|
||||
|
||||
(define (library? ast)
|
||||
(tagged-list? 'define-library ast))
|
||||
|
||||
|
@ -66,6 +59,9 @@
|
|||
|
||||
;; TODO: include-ci, cond-expand
|
||||
|
||||
(define (Cyc-installation-sld-dir) "")
|
||||
;(define (Cyc-installation-sld-dir) "/share/cyclone")
|
||||
|
||||
;; Resolve library filename given an import.
|
||||
;; Assumes ".sld" file extension if one is not specified.
|
||||
(define (lib:import->filename import . ext)
|
||||
|
@ -85,7 +81,7 @@
|
|||
(filename
|
||||
(substring filename* 1 (string-length filename*))))
|
||||
(if (tagged-list? 'scheme import)
|
||||
(string-append (cyc:get-lib-dir) filename) ;; Built-in library
|
||||
(string-append (Cyc-installation-dir) (Cyc-installation-sld-dir) "/" filename) ;; Built-in library
|
||||
filename)))
|
||||
|
||||
;; Get path to directory that contains the library
|
||||
|
@ -99,7 +95,7 @@
|
|||
(string-append (symbol->string i) "/"))
|
||||
import-path))))
|
||||
(if (tagged-list? 'scheme import)
|
||||
(string-append (cyc:get-lib-dir) path) ;; Built-in library
|
||||
(string-append (Cyc-installation-dir) (Cyc-installation-sld-dir) "/" path) ;; Built-in library
|
||||
path)))
|
||||
|
||||
;; Given a program's import set, resolve each import to its .o file, then
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
(scheme cyclone util)
|
||||
)
|
||||
(export
|
||||
cyc:get-clib-dir
|
||||
cyc:get-lib-dir
|
||||
cyc:get-include-dir
|
||||
library?
|
||||
lib:name
|
||||
lib:name->string
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
;;
|
||||
|
||||
(cond-expand
|
||||
; (chicken
|
||||
; (load (string-append (cyc:get-lib-dir) "scheme/common.scm")))
|
||||
(cyclone
|
||||
;; Temporary work-around for pp not being implemented yet
|
||||
(define pretty-print write))
|
||||
|
|
Loading…
Add table
Reference in a new issue