3 ## Copyright (C) 2006, 2011 Free Software Foundation
4 ## Written by Gary Benson <gbenson@redhat.com>
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; either version 2 of the License, or
9 ## (at your option) any later version.
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ## GNU General Public License for more details.
17 sys
.path
.insert(0, "@python_mod_dir_expanded@")
23 Usage: %s [OPTION...] SRCDIR DSTDIR
24 AOT-compile all Java bytecode in SRCDIR into DSTDIR.
27 -M, --make=PATH make executable to use (%s)
28 -C, --gcj=PATH gcj executable to use (%s)
29 -D, --dbtool=PATH gcj-dbtool executable to use (%s)
30 -m, --makeflags=FLAGS flags to pass to make during build
31 -c, --gcjflags=FLAGS flags to pass to gcj during compilation
33 -l, --ldflags=FLAGS flags to pass to gcj during linking
35 -e, --exclude=PATH do not compile PATH
37 Extra flags may also be passed using the AOT_MAKEFLAGS, AOT_GCJFLAGS
38 and AOT_LDFLAGS environment variables.""" % (
39 os
.path
.basename(sys
.argv
[0]),
40 aotcompile
.PATHS
["make"],
41 aotcompile
.PATHS
["gcj"],
42 aotcompile
.PATHS
["dbtool"],
43 repr(" ".join(aotcompile
.GCJFLAGS
)),
44 repr(" ".join(aotcompile
.LDFLAGS
)))
47 if os
.environ
.has_key("RPM_PACKAGE_NAME"):
48 raise aotcompile
.Error
, "not for use within rpm specfiles"
51 opts
, args
= getopt
.getopt(
54 ["make=", "gcj=", "dbtool=",
55 "makeflags=", "gcjflags=", "ldflags=",
59 print >>sys
.stderr
, usage
62 compiler
= aotcompile
.Compiler(srcdir
, dstdir
)
64 if o
in ("-M", "--make"):
65 aotcompile
.PATHS
["make"] = a
66 if o
in ("-C", "--gcj"):
67 aotcompile
.PATHS
["gcj"] = a
68 if o
in ("-D", "--dbtool"):
69 aotcompile
.PATHS
["dbtool"] = a
70 if o
in ("-m", "--makeflags"):
71 compiler
.makeflags
[0:0] = a
.split()
72 if o
in ("-c", "--gcjflags"):
73 compiler
.gcjflags
[0:0] = a
.split()
74 if o
in ("-l", "--ldflags"):
75 compiler
.ldflags
[0:0] = a
.split()
76 if o
in ("-e", "--exclude"):
77 compiler
.exclusions
.append(a
)
79 compiler
.makeflags
[0:0] = os
.environ
.get("AOT_MAKEFLAGS", "").split()
80 compiler
.gcjflags
[0:0] = os
.environ
.get("AOT_GCJFLAGS", "").split()
81 compiler
.ldflags
[0:0] = os
.environ
.get("AOT_LDFLAGS", "").split()
85 except aotcompile
.Error
, e
:
86 print >>sys
.stderr
, "%s: error: %s" % (
87 os
.path
.basename(sys
.argv
[0]), e
)