summaryrefslogtreecommitdiff
path: root/module/scripts/compile.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-12-01 23:31:50 +0100
committerAndy Wingo <wingo@pobox.com>2011-12-01 23:31:50 +0100
commitb2208d2e987759270c712e35c8164394a47a52aa (patch)
tree1edd39e74a266fc53c075d328696e8fbf33eba5b /module/scripts/compile.scm
parent3dc9f41900a0e9f915da3aa1eea6e0fae829c40d (diff)
parent738c899e4c1ab9d25cfbcd1010f34e0cce400bca (diff)
downloadguile-b2208d2e987759270c712e35c8164394a47a52aa.tar.gz
Merge remote-tracking branch 'origin/stable-2.0'
Conflicts: configure.ac libguile/fluids.c libguile/gc.c libguile/gc.h libguile/objcodes.c libguile/procprop.c libguile/vm.c module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm
Diffstat (limited to 'module/scripts/compile.scm')
-rw-r--r--module/scripts/compile.scm24
1 files changed, 17 insertions, 7 deletions
diff --git a/module/scripts/compile.scm b/module/scripts/compile.scm
index 0651c6804..20db94463 100644
--- a/module/scripts/compile.scm
+++ b/module/scripts/compile.scm
@@ -30,6 +30,7 @@
(define-module (scripts compile)
#:use-module ((system base compile) #:select (compile-file))
+ #:use-module (system base target)
#:use-module (system base message)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-13)
@@ -88,7 +89,12 @@
(lambda (opt name arg result)
(if (assoc-ref result 'to)
(fail "`--to' option cannot be specified more than once")
- (alist-cons 'to (string->symbol arg) result))))))
+ (alist-cons 'to (string->symbol arg) result))))
+ (option '(#\T "target") #t #f
+ (lambda (opt name arg result)
+ (if (assoc-ref result 'target)
+ (fail "`--target' option cannot be specified more than once")
+ (alist-cons 'target arg result))))))
(define (parse-args args)
"Parse argument list @var{args} and return an alist with all the relevant
@@ -109,7 +115,7 @@ options."
(define (show-version)
(format #t "compile (GNU Guile) ~A~%" (version))
- (format #t "Copyright (C) 2009 Free Software Foundation, Inc.
+ (format #t "Copyright (C) 2009, 2011 Free Software Foundation, Inc.
License LGPLv3+: GNU LGPL version 3 or later <http://gnu.org/licenses/lgpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.~%"))
@@ -134,6 +140,7 @@ There is NO WARRANTY, to the extent permitted by law.~%"))
o)))
(from (or (assoc-ref options 'from) 'scheme))
(to (or (assoc-ref options 'to) 'objcode))
+ (target (or (assoc-ref options 'target) %host-type))
(input-files (assoc-ref options 'input-files))
(output-file (assoc-ref options 'output-file))
(load-path (assoc-ref options 'load-path)))
@@ -152,6 +159,7 @@ Compile each Guile source file FILE into a Guile object.
-f, --from=LANG specify a source language other than `scheme'
-t, --to=LANG specify a target language other than `objcode'
+ -T, --target=TRIPLET produce bytecode for host TRIPLET
Note that auto-compilation will be turned off.
@@ -171,11 +179,13 @@ Report bugs to <~A>.~%"
(for-each (lambda (file)
(format #t "wrote `~A'\n"
(with-fluids ((*current-warning-prefix* ""))
- (compile-file file
- #:output-file output-file
- #:from from
- #:to to
- #:opts compile-opts))))
+ (with-target target
+ (lambda ()
+ (compile-file file
+ #:output-file output-file
+ #:from from
+ #:to to
+ #:opts compile-opts))))))
input-files)))
(define main compile)