📄 csc.scm
字号:
linked as needed. General options: -h -help display this text and exit -v show intermediate compilation stages -v2 -verbose display information about translation progress -v3 display information about all compilation stages -V -version display Scheme compiler version and exit -release display release number and exit File and pathname options: -o -output-file FILENAME specifies target executable name -I -include-path PATHNAME specifies alternative path for included files -to-stdout write compiler to stdout (implies -t) -s -shared -dynamic generate dynamically loadable shared object file Language options: -D -DSYMBOL -feature SYMBOL register feature identifier -c++ Compile via a C++ source file (.cpp) -objc Compile via Objective-C source file (.m) Syntax related options: -i -case-insensitive don't preserve case of read symbols -K -keyword-style STYLE allow alternative keyword syntax (prefix, suffix or none) -run-time-macros macros are made available at run-time Translation options: -x -explicit-use do not use units `library' and `eval' by default -P -check-syntax stop compilation after macro-expansion -A -analyze-only stop compilation after first analysis pass Debugging options: -w -no-warnings disable warnings -disable-warning CLASS disable specific class of warnings -d0 -d1 -d2 -debug-level NUMBER set level of available debugging information -no-trace disable rudimentary debugging information -profile executable emits profiling information -accumulate-profile executable emits profiling information in append mode -profile-name FILENAME name of the generated profile information file -emit-debug-info emit additional debug-information -emit-exports FILENAME write exported toplevel variables to FILENAME -G -check-imports look for undefined toplevel variables -import FILENAME read externally exported symbols from FILENAME Optimization options: -O -O1 -O2 -O3 -optimize-level NUMBER enable certain sets of optimization options -optimize-leaf-routines enable leaf routine optimization -N -no-usual-integrations standard procedures may be redefined -u -unsafe disable safety checks -b -block enable block-compilation -disable-interrupts disable interrupts in compiled code -f -fixnum-arithmetic assume all numbers are fixnums -Ob -benchmark-mode equivalent to '-block -optimize-level 3 -debug-level 0 -fixnum-arithmetic -lambda-lift -disable-interrupts' -lambda-lift perform lambda-lifting -unsafe-libraries link with unsafe runtime system -disable-stack-overflow-checks disables detection of stack-overflows -inline enable inlining -inline-limit set inlining threshold -disable-compiler-macros disable expansion of compiler macros Configuration options: -unit NAME compile file as a library unit -uses NAME declare library unit as used. -heap-size NUMBER specifies heap-size of compiled executable -heap-initial-size NUMBER specifies heap-size at startup time -heap-growth PERCENTAGE specifies growth-rate of expanding heap -heap-shrinkage PERCENTAGE specifies shrink-rate of contracting heap -nursery NUMBER -stack-size NUMBER specifies nursery size of compiled executable -X -extend FILENAME load file before compilation commences -prelude EXPRESSION add expression to beginning of source file -postlude EXPRESSION add expression to end of source file -prologue FILENAME include file before main source file -epilogue FILENAME include file after main source file -e -embedded compile as embedded (don't generate `main()') -W -windows compile as Windows GUI application (MSVC only) -R -require-extension NAME require extension in compiled code -E -extension compile as extension (dynamic or static) -dll -library compile multiple units into a dynamic library Options to other passes: -C OPTION pass option to C compiler -L OPTION pass option to linker -I<DIR> pass \"-I<DIR>\" to C compiler (add include path) -L<DIR> pass \"-L<DIR>\" to linker (add library path) -k keep intermediate files -c stop after compilation to object files -t stop after translation to C -cc COMPILER select other C compiler than the default one -cxx COMPILER select other C++ compiler than the default one -ld COMPILER select other linker than the default one -lLIBNAME link with given library (`libLIBNAME' on UNIX, `LIBNAME.lib' on Windows) -static-libs link with static CHICKEN libraries -static generate completely statically linked executable -static-extensions link with static extensions (if available) -F<DIR> pass \"-F<DIR>\" to C compiler (add framework header path on Mac OS X) -framework NAME passed to linker on Mac OS X -rpath PATHNAME add directory to runtime library search path -Wl,... pass linker options -strip strip resulting binary Inquiry options: -home show home-directory (where support files go) -cflags show required C-compiler flags and exit -ldflags show required linker flags and exit -libs show required libraries and exit -cc-name show name of default C compiler used -cxx-name show name of default C++ compiler used -ld-name show name of default linker used -dry-run just show commands executed, don't run them (implies `-v') Obscure options: -debug MODES display debugging output for the given modes -compiler PATHNAME use other compiler than default `chicken' -disable-c-syntax-checks disable syntax checks of C code fragments -raw do not generate implicit init- and exit code -emit-external-prototypes-first emit protoypes for callbacks before foreign declarations -keep-shadowed-macros do not remove shadowed macro -host compile for host when configured for cross-compiling Options can be collapsed if unambiguous, so -vkfO is the same as -v -k -fixnum-arithmetic -optimize The contents of the environment variable CSC_OPTIONS are implicitly passed to every invocation of `csc'.") );;; Parse arguments:(define (run args) (define (t-options . os) (set! translate-options (append translate-options os)) ) (define (check o r . n) (unless (>= (length r) (:optional n 1)) (quit "not enough arguments to option `~A'" o) ) ) (define (shared-build lib) (set! translate-options (cons* "-feature" "chicken-compile-shared" translate-options)) (set! compile-options (append pic-options '("-DC_SHARED") compile-options)) (set! link-options (cons (cond (osx (if lib "-dynamiclib" "-bundle")) (msvc "-dll") (else "-shared")) link-options)) (set! shared #t) ) (let loop ([args args]) (cond [(null? args) ;Builtin search directory options do not override explict options (set! compile-options (append compile-options builtin-compile-options)) (set! link-options (append link-options builtin-link-options)) ; (when inquiry-only (when show-cflags (print* (compiler-options) #\space)) (when show-ldflags (print* (linker-options) #\space)) (when show-libs (print* (linker-libraries #t) #\space)) (newline) (exit) ) #;(when (null? scheme-files) (set! scheme-files c-files) (set! c-files '()) ) (cond [(null? scheme-files) (when (and (null? c-files) (null? object-files)) (quit "no source files specified") ) (let ((f0 (last (if (null? c-files) object-files c-files)))) (unless target-filename (set! target-filename (if shared (pathname-replace-extension f0 shared-library-extension) (pathname-replace-extension f0 executable-extension) ) ) ) ) ] [else (when (and shared (not embedded)) (set! translate-options (cons "-dynamic" translate-options)) ) (unless target-filename (set! target-filename (if shared (pathname-replace-extension (first scheme-files) shared-library-extension) (pathname-replace-extension (first scheme-files) executable-extension) ) ) ) (run-translation) ] ) (unless translate-only (run-compilation) (unless compile-only (when (member target-filename scheme-files) (printf "Warning: output file will overwrite source file `~A' - renaming source to `~A.old'~%" target-filename target-filename) (unless (zero? ($system (sprintf "mv ~A ~A.old" target-filename target-filename))) (exit last-exit-code) ) ) (run-linking)) ) ] [else (let* ([arg (car args)] [rest (cdr args)] [s (string->symbol arg)] ) (case s [(-help --help) (usage) (exit) ] [(-release) (print (chicken-version)) (exit) ] [(-version) (system (sprintf translator " -version")) (exit) ] [(-c++) (set! cpp-mode #t) (when osx (set! compile-options (cons "-no-cpp-precomp" compile-options))) ] [(-objc) (set! objc-mode #t) ] [(-static) (set! translate-options (cons* "-feature" "chicken-compile-static" translate-options)) (set! static #t) ] [(-static-libs) (set! translate-options (cons* "-feature" "chicken-compile-static" translate-options)) (set! static-libs #t) ] [(-static-extensions) (set! static-extensions #t) ] [(-cflags) (set! inquiry-only #t) (set! show-cflags #t) ] [(-ldflags) (set! inquiry-only #t) (set! show-ldflags #t) ] [(-cc-name) (print compiler) (exit 0)] [(-cxx-name) (print c++-compiler) (exit 0)] [(-ld-name) (print linker) (exit 0)] [(-home) (print home) (exit 0)] [(-libs) (set! inquiry-only #t) (set! show-libs #t) ] [(-v) (set! verbose #t) ] [(-v2 -verbose) (set! verbose #t) (t-options "-verbose") ] [(-w -no-warnings) (set! compile-options (cons "-w" compile-options)) (t-options "-no-warnings") ] [(-v3) (set! verbose #t) (t-options "-verbose") (if (not msvc) (set! compile-options (cons* "-v" "-Q" compile-options))) (set! link-options (cons (if msvc "-VERBOSE" "-v") link-options)) ] [(|-A| -analyze-only) (set! translate-only #t) (t-options "-analyze-only") ] [(|-P| -check-syntax) (set! translate-only #t) (t-options "-check-syntax") ] [(-k) (set! keep-files #t)] [(-c) (set! compile-only #t)] [(-t) (set! translate-only #t)] [(-e -embedded) (set! embedded #t) (set! compile-options (cons "-DC_EMBEDDED" compile-options)) ] [(-require-extension -R) (check s rest) (set! required-extensions (append required-extensions (list (car rest)))) (t-options "-require-extension" (car rest)) (set! rest (cdr rest)) ] [(-windows |-W|) (set! gui #t) (cond (mingw (set! link-options (cons* "-lkernel32" "-luser32" "-lgdi32" "-mwindows" link-options)) (set! compile-options (cons "-DC_WINDOWS_GUI" compile-options))) (msvc (set! link-options (cons* "kernel32.lib" "user32.lib" "gdi32.lib" link-options)) (set! compile-options (cons "-DC_WINDOWS_GUI" compile-options)))) ] [(-framework) (check s rest) (when osx (set! link-options (cons* "-framework" (car rest) link-options)) ) (set! rest (cdr rest)) ] [(-o) (check s rest) (let ([fn (car rest)]) (set! rest (cdr rest)) (set! target-filename fn) ) ] [(|-O| |-O1|) (set! rest (cons* "-optimize-level" "1" rest))] [(|-O2|) (set! rest (cons* "-optimize-level" "2" rest))] [(|-O3|) (set! rest (cons* "-optimize-level" "3" rest))] [(-d0) (set! rest (cons* "-debug-level" "0" rest))] [(-d1) (set! rest (cons* "-debug-level" "1" rest))] [(-d2) (set! rest (cons* "-debug-level" "2" rest))] [(-dry-run)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -