mzc --xform
svn: r973
This commit is contained in:
parent
5dc1f6577a
commit
43abf620ac
|
@ -31,7 +31,8 @@
|
||||||
(lib "compile.ss" "dynext")
|
(lib "compile.ss" "dynext")
|
||||||
(lib "link.ss" "dynext")
|
(lib "link.ss" "dynext")
|
||||||
(lib "pack.ss" "setup")
|
(lib "pack.ss" "setup")
|
||||||
(lib "getinfo.ss" "setup"))
|
(lib "getinfo.ss" "setup")
|
||||||
|
(lib "plthome.ss" "setup"))
|
||||||
|
|
||||||
(define dest-dir (make-parameter #f))
|
(define dest-dir (make-parameter #f))
|
||||||
(define auto-dest-dir (make-parameter #f))
|
(define auto-dest-dir (make-parameter #f))
|
||||||
|
@ -117,6 +118,11 @@
|
||||||
(extract-suffix append-object-suffix)
|
(extract-suffix append-object-suffix)
|
||||||
(extract-suffix append-extension-suffix))
|
(extract-suffix append-extension-suffix))
|
||||||
"extension")]
|
"extension")]
|
||||||
|
[("--xform")
|
||||||
|
,(lambda (f) 'xform)
|
||||||
|
(,(format "Convert for 3m compilation: ~a -> ~a"
|
||||||
|
(extract-suffix append-c-suffix)
|
||||||
|
(extract-suffix append-c-suffix)))]
|
||||||
[("--exe")
|
[("--exe")
|
||||||
,(lambda (f name) (exe-output name) 'exe)
|
,(lambda (f name) (exe-output name) 'exe)
|
||||||
(,(format "Embed module in MzScheme to create <exe>")
|
(,(format "Embed module in MzScheme to create <exe>")
|
||||||
|
@ -231,6 +237,24 @@
|
||||||
(printf "C linker libraries: ~s~n" (expand-for-link-variant
|
(printf "C linker libraries: ~s~n" (expand-for-link-variant
|
||||||
(current-standard-link-libraries))))
|
(current-standard-link-libraries))))
|
||||||
("Show C linker libraries")]]
|
("Show C linker libraries")]]
|
||||||
|
[multi
|
||||||
|
[("++cppf")
|
||||||
|
,(lambda (f v) (current-extension-preprocess-flags
|
||||||
|
(append (current-extension-preprocess-flags)
|
||||||
|
(list v))))
|
||||||
|
("Add C preprocess (xform) flag" "flag")]
|
||||||
|
[("--cppf")
|
||||||
|
,(lambda (f v) (current-extension-preprocess-flags
|
||||||
|
(remove v (current-extension-preprocess-flags))))
|
||||||
|
("Remove C preprocess (xform) flag" "flag")]
|
||||||
|
[("--cppf-clear")
|
||||||
|
,(lambda (f) (current-extension-preprocess-flags null))
|
||||||
|
("Clear C preprocess (xform) flags")]
|
||||||
|
[("--cppf-show")
|
||||||
|
,(lambda (f)
|
||||||
|
(printf "C compiler flags: ~s~n" (expand-for-link-variant
|
||||||
|
(current-extension-preprocess-flags))))
|
||||||
|
("Show C preprocess (xform) flags")]]
|
||||||
[help-labels
|
[help-labels
|
||||||
"--------------------- executable configuration flags ------------------------"]
|
"--------------------- executable configuration flags ------------------------"]
|
||||||
[once-each
|
[once-each
|
||||||
|
@ -455,6 +479,16 @@
|
||||||
source-files
|
source-files
|
||||||
dest)
|
dest)
|
||||||
(printf " [output to \"~a\"]~n" dest))]
|
(printf " [output to \"~a\"]~n" dest))]
|
||||||
|
[(xform)
|
||||||
|
(for-each (lambda (file)
|
||||||
|
(let ([out-file (path-replace-suffix file ".3m.c")])
|
||||||
|
((dynamic-require '(lib "xform.ss" "compiler") 'xform)
|
||||||
|
(not (compiler:option:verbose))
|
||||||
|
file
|
||||||
|
out-file
|
||||||
|
(list (build-path plthome "include")))
|
||||||
|
(printf " [output to \"~a\"]~n" out-file)))
|
||||||
|
source-files)]
|
||||||
[(exe gui-exe)
|
[(exe gui-exe)
|
||||||
(unless (= 1 (length source-files))
|
(unless (= 1 (length source-files))
|
||||||
(error 'mzc "expected a single module source file to embed; given: ~e"
|
(error 'mzc "expected a single module source file to embed; given: ~e"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
[headers (apply append
|
[headers (apply append
|
||||||
(map (current-make-compile-include-strings)
|
(map (current-make-compile-include-strings)
|
||||||
header-dirs))])
|
header-dirs))])
|
||||||
(xform:xform #f
|
(xform:xform quiet?
|
||||||
(cons exe
|
(cons exe
|
||||||
(append flags headers))
|
(append flags headers))
|
||||||
src
|
src
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
(define-signature dynext:compile^
|
(define-signature dynext:compile^
|
||||||
(compile-extension
|
(compile-extension
|
||||||
|
preprocess-extension
|
||||||
current-extension-compiler
|
current-extension-compiler
|
||||||
current-extension-compiler-flags
|
current-extension-compiler-flags
|
||||||
current-extension-preprocess-flags
|
current-extension-preprocess-flags
|
||||||
|
|
|
@ -248,7 +248,7 @@
|
||||||
(lambda (start-process quiet?)
|
(lambda (start-process quiet?)
|
||||||
(do-stdio start-process quiet? (lambda (s) (error 'compile-extension "~a" s)))))))
|
(do-stdio start-process quiet? (lambda (s) (error 'compile-extension "~a" s)))))))
|
||||||
|
|
||||||
(define unix/windows-compile
|
(define (make-compile-extension current-extension-compiler-flags)
|
||||||
(lambda (quiet? in out includes)
|
(lambda (quiet? in out includes)
|
||||||
(let ([c (current-extension-compiler)])
|
(let ([c (current-extension-compiler)])
|
||||||
(if c
|
(if c
|
||||||
|
@ -271,13 +271,7 @@
|
||||||
quiet?)
|
quiet?)
|
||||||
(error 'compile-extension "can't find an installed C compiler")))))
|
(error 'compile-extension "can't find an installed C compiler")))))
|
||||||
|
|
||||||
(include (build-path "private" "macinc.ss"))
|
(define compile-extension (make-compile-extension
|
||||||
|
current-extension-compiler-flags))
|
||||||
(define (macos-compile quiet? input-file output-file includes)
|
(define preprocess-extension (make-compile-extension
|
||||||
(macos-make 'compile-extension "extension-project" "lib" quiet?
|
current-extension-compiler-flags)))))
|
||||||
(list input-file) output-file includes))
|
|
||||||
|
|
||||||
(define compile-extension
|
|
||||||
(case (system-type)
|
|
||||||
[(unix windows macosx) unix/windows-compile]
|
|
||||||
[(macos) macos-compile])))))
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user