~ubuntu-branches/ubuntu/lucid/gauche-c-wrapper/lucid

« back to all changes in this revision

Viewing changes to src/cwcompile.in

  • Committer: Bazaar Package Importer
  • Author(s): NIIBE Yutaka
  • Date: 2008-04-07 09:15:03 UTC
  • Revision ID: james.westby@ubuntu.com-20080407091503-wu0h414koe95kj4i
Tags: upstream-0.5.2
ImportĀ upstreamĀ versionĀ 0.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!@GOSH@
 
2
;; -*- coding: utf-8; mode: scheme -*-
 
3
;;
 
4
;; cwcompile - stub generator for c-wrapper
 
5
;; 
 
6
;;  Copyright (c) 2006 KOGURO, Naoki (naoki@koguro.net)
 
7
;; 
 
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:
 
16
;; 
 
17
;;  The above copyright notice and this permission notice shall 
 
18
;;  be included in all copies or substantial portions of the 
 
19
;;  Software.
 
20
;; 
 
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.
 
29
;; 
 
30
;;  $Id: $
 
31
 
 
32
(use gauche.parseopt)
 
33
(use c-wrapper.stubgen)
 
34
 
 
35
(define (usage progname)
 
36
  (format #t "Usage: ~a [options] <scheme-file> ...~%" (sys-basename progname))
 
37
  (print  "  Generate .so file from scheme file(s).")
 
38
  (print  "")
 
39
  (print  "Options:")
 
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.")
 
46
  (exit 1))
 
47
 
 
48
(define (main args)
 
49
  (let ((prognam (car args)))
 
50
    (let-args (cdr args)
 
51
        ((clean? "clean" #f)
 
52
         (cppflags "cppflags=s" "")
 
53
         (cflags "cflags=s" "")
 
54
         (ldflags "ldflags=s" "")
 
55
         (libs "libs=s" "")
 
56
         (verbose? "v|verbose" #f)
 
57
         (help? "h|help" => (cut usage prognam))
 
58
         (else (option . _)
 
59
               (format #t "unrecognized option: ~a" option)
 
60
               (usage prognam))
 
61
         . args)
 
62
      (when (null? args)
 
63
        (usage prognam))
 
64
      (for-each (lambda (scm-file)
 
65
                  (compile-wrapper scm-file
 
66
                                   (if clean? 'clean 'compile)
 
67
                                   cflags
 
68
                                   cppflags
 
69
                                   ldflags
 
70
                                   libs
 
71
                                   verbose?))
 
72
                args)))
 
73
  0)
 
74
 
 
75
;; Local variables:
 
76
;; mode: scheme
 
77
;; end: