This repository has been archived by the owner on Oct 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
wscript
74 lines (55 loc) · 1.79 KB
/
wscript
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python
import platform
top = '.'
out = 'build'
bld_subdirs = [
'libmcapi',
'util',
'demo',
]
subdirs = bld_subdirs + ['test']
def getarch():
classes = {
'i386': 'x86',
'i586': 'x86',
'i686': 'x86',
'ppc': 'powerpc',
}
arch = platform.machine()
return classes.get(arch, arch)
def options(opt):
opt.load('compiler_c')
opt.add_option('--arch', default=getarch())
opt.add_option('--os', default='linux')
opt.add_option('--transport', default='shm', help='Transport driver, e.g. \'shm\' for shared memory')
opt.add_option('--cross', default='', help='Cross compiler prefix, e.g. powerpc-linux-gnu-')
opt.add_option('--cc', default='gcc')
opt.add_option('--no-kmods', action='store_true', help='Don\'t build Linux kernel modules')
opt.recurse(subdirs)
def build(bld):
bld.recurse(bld_subdirs)
def configure(conf):
conf.env.ARCH = conf.options.arch
conf.define('CONFIG_%s' % conf.env.ARCH.upper(), 1)
conf.env.OS = conf.options.os
conf.define('CONFIG_%s' % conf.env.OS.upper(), 1)
conf.env.TRANSPORT = conf.options.transport
conf.define('CONFIG_%s' % conf.env.TRANSPORT.upper(), 1)
conf.env.CROSS = conf.options.cross
conf.env.CC = conf.env.CROSS + conf.options.cc
conf.load('compiler_c')
# compiler_c checks if CC is a GCC or not, and tells us in COMPILER_CC
conf.define('CONFIG_%s' % conf.env.COMPILER_CC.upper(), 1)
conf.env.NO_KMODS = conf.options.no_kmods
conf.recurse(subdirs)
# Create config.h and make sure every file uses it, without needing an
# explicit #include
config_h = 'config.h'
cppflags = [ '-I', conf.path.get_bld().abspath(), '-include', config_h, ]
conf.env.prepend_value('CPPFLAGS', cppflags)
conf.write_config_header(config_h)
def test(tst):
global bld_subdirs
bld_subdirs += ['test']
import Options
Options.commands += ['build']