Updated Makefile
This commit is contained in:
+274
@@ -0,0 +1,274 @@
|
||||
(define-library
|
||||
(libs data)
|
||||
(import (scheme base))
|
||||
(export data)
|
||||
(begin
|
||||
(define data
|
||||
`((chibi
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(apply string-append
|
||||
`("chibi-scheme"
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "-I" " " item " "))
|
||||
prepend-directories)
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "-A" " " item " "))
|
||||
append-directories)
|
||||
,input-file)))))
|
||||
(chicken
|
||||
(type . compiler)
|
||||
(library-command . ,(lambda (library-file prepend-directories append-directories)
|
||||
(string-append "csc -J "
|
||||
" "
|
||||
library-file)))
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(string-append "csc -static " input-file))))
|
||||
(gambit
|
||||
(type . compiler)
|
||||
(library-command . ,(lambda (library-file prepend-directories append-directories)
|
||||
(apply string-append
|
||||
`("gsc -c"
|
||||
" "
|
||||
"-o"
|
||||
" "
|
||||
,(string-append (string-copy library-file
|
||||
0
|
||||
(- (string-length library-file)
|
||||
4))
|
||||
".c ")
|
||||
" "
|
||||
,@(map (lambda (item) (string-append item "/ ")) prepend-directories)
|
||||
,@(map (lambda (item) (string-append item "/ ")) append-directories)
|
||||
,library-file))))
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(apply string-append
|
||||
`("gsc -nopreload -exe"
|
||||
" "
|
||||
,@(map (lambda (item) (string-append item "/ ")) prepend-directories)
|
||||
,@(map (lambda (item) (string-append item "/ ")) append-directories)
|
||||
" "
|
||||
,input-file
|
||||
;" "
|
||||
;"&&"
|
||||
;" "
|
||||
;"gsc"
|
||||
;" "
|
||||
;"-o"
|
||||
;" "
|
||||
;,output-file
|
||||
;" "
|
||||
;"-exe"
|
||||
;,@(map (lambda (item) (string-append item "/ ")) prepend-directories)
|
||||
;,@(map (lambda (item) (string-append item "/ ")) append-directories)
|
||||
;" "
|
||||
;,@(map (lambda (item) (string-append (string-copy item 0 (- (string-length item) 4)) ".c")) library-files)
|
||||
;" "
|
||||
;,(string-copy input-file 0 (- (string-length input-file) 4))
|
||||
;".c"
|
||||
)))))
|
||||
(cyclone
|
||||
(type . compiler)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(apply string-append
|
||||
`("cyclone "
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "-I" " " item " "))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "-A" " " item " "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
(gauche
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(apply string-append
|
||||
`("gosh -r7"
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "-I" " " item " "))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "-A" " " item " "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
(loko
|
||||
(type . compiler)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(apply string-append
|
||||
`("LOKO_LIBRARY_PATH="
|
||||
,@(map (lambda (item)
|
||||
(string-append item ":"))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append item ":"))
|
||||
append-directories)
|
||||
" "
|
||||
"loko -std=r7rs --compile"
|
||||
" "
|
||||
,input-file)))))
|
||||
(guile
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(apply string-append
|
||||
`("guile --r7rs"
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "-L" " " item " "))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "-L" " " item " "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
(kawa
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(apply string-append
|
||||
`("kawa --r7rs --full-tailcalls"
|
||||
" "
|
||||
"-Dkawa.import.path="
|
||||
,@(map (lambda (item)
|
||||
(string-append item ":" item "/*.sld:" " "))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append item ":" item "/*.sld:" " "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
(mosh
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(apply string-append
|
||||
`("mosh"
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "--loadpath=" item " "))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "--loadpath=" item " "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
(racket
|
||||
(type . compiler)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(let ((rkt-input-file (if (string=? input-file "")
|
||||
""
|
||||
(change-file-suffix input-file ".rkt"))))
|
||||
(when (not (string=? rkt-input-file ""))
|
||||
(if (file-exists? rkt-input-file)
|
||||
(delete-file rkt-input-file))
|
||||
(with-output-to-file
|
||||
rkt-input-file
|
||||
(lambda ()
|
||||
(display "#lang r7rs")
|
||||
(newline)
|
||||
(display "(import (scheme base))")
|
||||
(newline)
|
||||
(display "(include \"")
|
||||
(display (path->filename input-file))
|
||||
(display "\")")
|
||||
(newline))))
|
||||
(for-each
|
||||
(lambda (file)
|
||||
(let ((library-rkt-file (change-file-suffix file ".rkt")))
|
||||
(if (file-exists? library-rkt-file)
|
||||
(delete-file library-rkt-file))
|
||||
(with-output-to-file
|
||||
library-rkt-file
|
||||
(lambda ()
|
||||
(display "#lang r7rs")
|
||||
(newline)
|
||||
(display "(import (scheme base))")
|
||||
(newline)
|
||||
(display "(include \"")
|
||||
(display (path->filename file))
|
||||
(display "\")")
|
||||
(newline)))))
|
||||
library-files)
|
||||
(apply string-append
|
||||
`("PLTCOLLECTS="
|
||||
,(string-join prepend-directories ":")
|
||||
,(string-join append-directories ":")
|
||||
" "
|
||||
"raco exe --orig-exe ++lang r7rs -o "
|
||||
,output-file
|
||||
" "
|
||||
,rkt-input-file))))))
|
||||
(sagittarius
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(apply string-append
|
||||
`("sash -r7"
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "-L " item " "))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "-A " item " "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
(skint
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(apply string-append
|
||||
`("skint"
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "-I " item "/ "))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "-A " item "/ "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
(stklos
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(apply string-append
|
||||
`("stklos"
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "-I " item " "))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "-A " item " "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
(tr7
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(apply string-append
|
||||
`("TR7_LIB_PATH="
|
||||
,@(map (lambda (item)
|
||||
(string-append item ":"))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append item ":"))
|
||||
append-directories)
|
||||
" "
|
||||
"tr7i"
|
||||
" "
|
||||
,input-file)))))
|
||||
(ypsilon
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files)
|
||||
(apply string-append
|
||||
`("ypsilon --r7rs"
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "--sitelib=" item))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "--sitelib=" item))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))))))
|
||||
@@ -0,0 +1,81 @@
|
||||
(define-library
|
||||
(libs util)
|
||||
(import (scheme base))
|
||||
(export string-replace
|
||||
string-ends-with?
|
||||
string-starts-with?
|
||||
string-find
|
||||
string-reverse
|
||||
path->filename
|
||||
change-file-suffix
|
||||
string-join)
|
||||
(begin
|
||||
(define string-replace
|
||||
(lambda (string-content replace with)
|
||||
(string-map (lambda (c) (char=? c replace) with c) string-content)))
|
||||
|
||||
(define string-ends-with?
|
||||
(lambda (string-content end)
|
||||
(if (and (>= (string-length string-content) (string-length end))
|
||||
(string=? (string-copy string-content
|
||||
(- (string-length string-content)
|
||||
(string-length end)))
|
||||
end))
|
||||
#t
|
||||
#f)))
|
||||
|
||||
(define string-starts-with?
|
||||
(lambda (string-content start)
|
||||
(if (and (>= (string-length string-content) (string-length start))
|
||||
(string=? (string-copy string-content
|
||||
0
|
||||
(string-length start))
|
||||
start))
|
||||
#t
|
||||
#f)))
|
||||
|
||||
(define string-find
|
||||
(lambda (string-content character)
|
||||
(letrec* ((string-list (string->list string-content))
|
||||
(looper (lambda (c rest index)
|
||||
(cond ((null? rest) #f)
|
||||
((char=? c character) index)
|
||||
(else (looper (car rest)
|
||||
(cdr rest)
|
||||
(+ index 1)))))))
|
||||
(looper (car string-list)
|
||||
(cdr string-list)
|
||||
0))))
|
||||
|
||||
(define string-reverse
|
||||
(lambda (string-content)
|
||||
(list->string (reverse (string->list string-content)))))
|
||||
|
||||
(define path->filename
|
||||
(lambda (path)
|
||||
(let ((last-slash-index (string-find (string-reverse path) #\/)))
|
||||
(cond ((not last-slash-index) path)
|
||||
(else (string-copy path (- (string-length path)
|
||||
last-slash-index)))))))
|
||||
|
||||
(define change-file-suffix
|
||||
(lambda (path new-suffix)
|
||||
(let ((last-dot-index (string-find (string-reverse path) #\.)))
|
||||
(cond ((not last-dot-index) path)
|
||||
(else (string-append (string-copy path 0
|
||||
(- (string-length path)
|
||||
last-dot-index
|
||||
1))
|
||||
new-suffix))))))
|
||||
|
||||
(define string-join
|
||||
(lambda (string-list between)
|
||||
(apply string-append
|
||||
(let ((index 0)
|
||||
(size (length string-list)))
|
||||
(map
|
||||
(lambda (item)
|
||||
(cond ((= index 0) item)
|
||||
((= index size) item)
|
||||
(else (string-append item between))))
|
||||
string-list)))))))
|
||||
Reference in New Issue
Block a user