-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·40 lines (29 loc) · 1.25 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
import os, os.path, sys, shutil
import datetime
from optparse import OptionParser
def main(args):
op = OptionParser("Usage: %prog --with-gcc|--with-llvm=<llvm-root-dir>")
op.add_option('','--with-gcc', dest='withGCC', action='store_true',
default=False,
help='Compile a gcc version.')
op.add_option('','--with-llvm', dest='withLLVM', action='store',
type="string", default='',
help='Compile with LLVM, residing in the given directory.')
opts,args = op.parse_args()
if not opts.withGCC and opts.withLLVM == '':
op.error("You need to specify either --with-gcc or --with-llvm.")
if (opts.withGCC and opts.withLLVM != ''):
op.error("Use only one of --with-gcc and --with-llvm.")
if (opts.withGCC):
shutil.copyfile("Rules.mak.gcc", "Rules.mak")
print "Using gcc... done"
else:
if not os.path.exists(opts.withLLVM):
op.error("Cannot find LLVM root directory.")
os.system('echo "UCLIBC_TOP_DIR=`pwd`" > Rules.mak')
command = 'echo "LLVMROOTDIR=' + opts.withLLVM + '" >> Rules.mak'; os.system(command)
os.system('cat Rules.mak.llvm >> Rules.mak')
print "Using llvm... done"
if __name__ == '__main__':
main(sys.argv)