mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 08:47:35 +02:00
Added the -COPT compiler option
This allows easily specifying compiler options such as directories to search for header files.
This commit is contained in:
parent
64e289c43b
commit
046e7020b2
1 changed files with 26 additions and 9 deletions
35
cyclone.scm
35
cyclone.scm
|
@ -694,7 +694,7 @@
|
||||||
|
|
||||||
;; Compile and emit:
|
;; Compile and emit:
|
||||||
(define (run-compiler args cc? cc-prog cc-exec cc-lib cc-so
|
(define (run-compiler args cc? cc-prog cc-exec cc-lib cc-so
|
||||||
cc-prog-linker-opts cc-prog-linker-objs
|
cc-opts cc-prog-linker-opts cc-prog-linker-objs
|
||||||
append-dirs prepend-dirs)
|
append-dirs prepend-dirs)
|
||||||
(let* ((in-file (car args))
|
(let* ((in-file (car args))
|
||||||
(expander (base-expander))
|
(expander (base-expander))
|
||||||
|
@ -771,12 +771,16 @@
|
||||||
(string-append " " (lib:import->filename i ".o" append-dirs prepend-dirs) " "))
|
(string-append " " (lib:import->filename i ".o" append-dirs prepend-dirs) " "))
|
||||||
lib-deps))))
|
lib-deps))))
|
||||||
(comp-prog-cmd
|
(comp-prog-cmd
|
||||||
(string-replace-all
|
(string-append
|
||||||
(string-replace-all
|
(string-replace-all
|
||||||
;(Cyc-compilation-environment 'cc-prog)
|
(string-replace-all
|
||||||
(get-comp-env 'cc-prog cc-prog)
|
;(Cyc-compilation-environment 'cc-prog)
|
||||||
"~src-file~" src-file)
|
(get-comp-env 'cc-prog cc-prog)
|
||||||
"~exec-file~" exec-file))
|
"~src-file~" src-file)
|
||||||
|
"~exec-file~" exec-file)
|
||||||
|
" "
|
||||||
|
cc-opts
|
||||||
|
" "))
|
||||||
(comp-objs-cmd
|
(comp-objs-cmd
|
||||||
(string-append
|
(string-append
|
||||||
(string-replace-all
|
(string-replace-all
|
||||||
|
@ -813,17 +817,25 @@
|
||||||
(write (macro:get-defined-macros))))
|
(write (macro:get-defined-macros))))
|
||||||
;; Compile library
|
;; Compile library
|
||||||
(let ((comp-lib-cmd
|
(let ((comp-lib-cmd
|
||||||
|
(string-append
|
||||||
(string-replace-all
|
(string-replace-all
|
||||||
(string-replace-all
|
(string-replace-all
|
||||||
(get-comp-env 'cc-lib cc-lib)
|
(get-comp-env 'cc-lib cc-lib)
|
||||||
"~src-file~" src-file)
|
"~src-file~" src-file)
|
||||||
"~exec-file~" exec-file))
|
"~exec-file~" exec-file)
|
||||||
|
" "
|
||||||
|
cc-opts
|
||||||
|
" "))
|
||||||
(comp-so-cmd
|
(comp-so-cmd
|
||||||
|
(string-append
|
||||||
(string-replace-all
|
(string-replace-all
|
||||||
(string-replace-all
|
(string-replace-all
|
||||||
(get-comp-env 'cc-so cc-so)
|
(get-comp-env 'cc-so cc-so)
|
||||||
"~src-file~" src-file)
|
"~src-file~" src-file)
|
||||||
"~exec-file~" exec-file))
|
"~exec-file~" exec-file)
|
||||||
|
" "
|
||||||
|
cc-opts
|
||||||
|
" "))
|
||||||
)
|
)
|
||||||
(cond
|
(cond
|
||||||
(cc?
|
(cc?
|
||||||
|
@ -871,6 +883,7 @@
|
||||||
(cc-exec (apply string-append (collect-opt-values args "-CE")))
|
(cc-exec (apply string-append (collect-opt-values args "-CE")))
|
||||||
(cc-lib (apply string-append (collect-opt-values args "-CL")))
|
(cc-lib (apply string-append (collect-opt-values args "-CL")))
|
||||||
(cc-so (apply string-append (collect-opt-values args "-CS")))
|
(cc-so (apply string-append (collect-opt-values args "-CS")))
|
||||||
|
(cc-opts (apply string-append (collect-opt-values args "-COPT")))
|
||||||
(cc-linker-opts (apply string-append (collect-opt-values args "-CLNK")))
|
(cc-linker-opts (apply string-append (collect-opt-values args "-CLNK")))
|
||||||
(cc-linker-extra-objects (apply string-append (collect-opt-values args "-COBJ")))
|
(cc-linker-extra-objects (apply string-append (collect-opt-values args "-COBJ")))
|
||||||
(opt-beta-expand-thresh (collect-opt-values args "-opt-be"))
|
(opt-beta-expand-thresh (collect-opt-values args "-opt-be"))
|
||||||
|
@ -930,6 +943,8 @@ General options:
|
||||||
when linking a program. For example, this may be used
|
when linking a program. For example, this may be used
|
||||||
to link an executable where some object files are generated
|
to link an executable where some object files are generated
|
||||||
via a makefile instead of by Cyclone.
|
via a makefile instead of by Cyclone.
|
||||||
|
-COPT options Specify custom options to provide to the C compiler,
|
||||||
|
EG: \"-Imy-directory\".
|
||||||
-CLNK option Specify a custom command to provide as a linker option,
|
-CLNK option Specify a custom command to provide as a linker option,
|
||||||
EG: \"-lcurl\".
|
EG: \"-lcurl\".
|
||||||
-d Only generate intermediate C files, do not compile them
|
-d Only generate intermediate C files, do not compile them
|
||||||
|
@ -1007,5 +1022,7 @@ Debug options:
|
||||||
(cdr err))
|
(cdr err))
|
||||||
(newline)
|
(newline)
|
||||||
(exit 1)))
|
(exit 1)))
|
||||||
(run-compiler non-opts compile? cc-prog cc-exec cc-lib cc-so cc-linker-opts cc-linker-extra-objects append-dirs prepend-dirs)))))
|
(run-compiler non-opts compile? cc-prog cc-exec cc-lib cc-so
|
||||||
|
cc-opts cc-linker-opts cc-linker-extra-objects
|
||||||
|
append-dirs prepend-dirs)))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue