OpenCores
URL https://opencores.org/ocsvn/funbase_ip_library/funbase_ip_library/trunk

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.swp.api/] [openmcapi/] [1.0/] [wscript] - Blame information for rev 175

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
#!/usr/bin/env python
2
 
3
import platform
4
 
5
top = '.'
6
out = 'build'
7
 
8
bld_subdirs = [
9
        'libmcapi',
10
        'util',
11
        'demo',
12
        ]
13
subdirs = bld_subdirs + ['test']
14
 
15
def getarch():
16
        classes = {
17
                'i386': 'x86',
18
                'i586': 'x86',
19
                'i686': 'x86',
20
                'ppc': 'powerpc',
21
        }
22
 
23
        arch = platform.machine()
24
        return classes.get(arch, arch)
25
 
26
def options(opt):
27
        opt.load('compiler_c')
28
        opt.add_option('--arch', default=getarch())
29
        opt.add_option('--os', default='linux')
30
        opt.add_option('--transport', default='shm', help='Transport driver, e.g. \'shm\' for shared memory')
31
        opt.add_option('--cross', default='', help='Cross compiler prefix, e.g. powerpc-linux-gnu-')
32
        opt.add_option('--cc', default='gcc')
33
        opt.add_option('--no-kmods', action='store_true', help='Don\'t build Linux kernel modules')
34
 
35
        opt.recurse(subdirs)
36
 
37
def build(bld):
38
        bld.recurse(bld_subdirs)
39
 
40
def configure(conf):
41
        conf.env.ARCH = conf.options.arch
42
        conf.define('CONFIG_%s' % conf.env.ARCH.upper(), 1)
43
 
44
        conf.env.OS = conf.options.os
45
        conf.define('CONFIG_%s' % conf.env.OS.upper(), 1)
46
 
47
        conf.env.TRANSPORT = conf.options.transport
48
        conf.define('CONFIG_%s' % conf.env.TRANSPORT.upper(), 1)
49
 
50
        conf.env.CROSS = conf.options.cross
51
        conf.env.CC = conf.env.CROSS + conf.options.cc
52
 
53
        conf.load('compiler_c')
54
        # compiler_c checks if CC is a GCC or not, and tells us in COMPILER_CC
55
        conf.define('CONFIG_%s' % conf.env.COMPILER_CC.upper(), 1)
56
 
57
        conf.env.NO_KMODS = conf.options.no_kmods
58
 
59
        conf.recurse(subdirs)
60
 
61
        # Create config.h and make sure every file uses it, without needing an
62
        # explicit #include
63
        config_h = 'config.h'
64
        cppflags = [ '-I', conf.path.get_bld().abspath(), '-include', config_h, ]
65
        conf.env.prepend_value('CPPFLAGS', cppflags)
66
        conf.write_config_header(config_h)
67
 
68
def test(tst):
69
        global bld_subdirs
70
        bld_subdirs += ['test']
71
 
72
        import Options
73
        Options.commands += ['build']
74
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.