2
;; -*- coding: utf-8; mode: scheme -*-
4
;; cwcompile - stub generator for c-wrapper
6
;; Copyright (c) 2006 KOGURO, Naoki (naoki@koguro.net)
8
;; Permission is hereby granted, free of charge, to any person
9
;; obtaining a copy of this software and associated
10
;; documentation files (the "Software"), to deal in the
11
;; Software without restriction, including without limitation
12
;; the rights to use, copy, modify, merge, publish, distribute,
13
;; sublicense, and/or sell copies of the Software, and to
14
;; permit persons to whom the Software is furnished to do so,
15
;; subject to the following conditions:
17
;; The above copyright notice and this permission notice shall
18
;; be included in all copies or substantial portions of the
21
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
22
;; KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
23
;; WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
24
;; PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
25
;; OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26
;; OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27
;; OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33
(use c-wrapper.stubgen)
35
(define (usage progname)
36
(format #t "Usage: ~a [options] <scheme-file> ...~%" (sys-basename progname))
37
(print " Generate .so file from scheme file(s).")
40
(print " -v, --verbose : reports commands being executed.")
41
(print " --clean : removes the intermidiate and output files.")
42
(print " --cppflags=CPPFLAGS : extra cpp flags for compile.")
43
(print " --cflags=CFLAGS : extra cc flags for compile.")
44
(print " --ldflags=LDFLAGS : extra ld flags.")
45
(print " --libs=LIBS : extra libraries.")
49
(let ((prognam (car args)))
52
(cppflags "cppflags=s" "")
53
(cflags "cflags=s" "")
54
(ldflags "ldflags=s" "")
56
(verbose? "v|verbose" #f)
57
(help? "h|help" => (cut usage prognam))
59
(format #t "unrecognized option: ~a" option)
64
(for-each (lambda (scm-file)
65
(compile-wrapper scm-file
66
(if clean? 'clean 'compile)