summaryrefslogtreecommitdiffstats
path: root/win/build_ddk.py
blob: ca68e81d1879fd2943ba9a9dea56e14c2d19e790 (plain)
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
import os
from wb import system, home_fn, choose_arch

def build_ddk(config, dir, x64):
    setenv_bat = os.path.realpath(os.path.join(config['DDK_PATH'], 'bin/setenv.bat'))
    ddk_major = int(config['DDKVER_MAJOR'])
    debug = 'PRODUCT_TAP_DEBUG' in config
    target = 'chk' if debug else 'fre'
    if x64:
        target += ' x64'
    else:
        target += ' x86'
    if ddk_major >= 7600:
        if x64:
            target += ' wlh'  # vista

        else:
            target += ' wnet' # server 2003

    else:
        if x64:
            target += ' wnet' # server 2003

        else:
            target += ' w2k'  # 2000


    system('cmd /c "%s %s %s && cd %s && build -cef"' % (
           setenv_bat,
           os.path.realpath(config['DDK_PATH']),
           target,
           dir
           ))

def main(config, proj, arch):
    if proj == 'tap':
        dir = home_fn('tap-win32')
    elif proj == 'tapinstall':
        dir = home_fn('tapinstall')
    else:
        raise ValueError("unknown project: %s" % (proj,))

    for x64 in choose_arch(arch):
        build_ddk(config, dir, x64)

# if we are run directly, and not loaded as a module

if __name__ == "__main__":
    import sys
    from wb import config
    if len(sys.argv) >= 3:
        main(config, sys.argv[1], sys.argv[2])
    else:
        print "usage: build <tap|tapinstall> <x64|x86|all>"
        sys.exit(2)