src/tap-bridge/wscript
author Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
Thu, 08 Sep 2011 16:13:40 +0100
changeset 7487 82cd20da9650
parent 7294 1ebf059e9ebc
child 7494 d93f5e8e0a59
permissions -rw-r--r--
Upgrade to waf-1.6.7, work in progress
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     2
5975
c85cb9b073a0 comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents: 4390
diff changeset
     3
import os.path
c85cb9b073a0 comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents: 4390
diff changeset
     4
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     5
def configure(conf):
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     6
    if conf.env['ENABLE_THREADING']:
4186
f1d57182d491 tighten up configuration reqs for tap and emu
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
     7
        conf.env['ENABLE_TAP'] = conf.check(header_name='linux/if_tun.h',
f1d57182d491 tighten up configuration reqs for tap and emu
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
     8
                                            define_name='HAVE_IF_TUN_H')
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     9
        conf.report_optional_feature("TapBridge", "Tap Bridge",
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    10
                                     conf.env['ENABLE_TAP'],
4186
f1d57182d491 tighten up configuration reqs for tap and emu
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
    11
                                     "<linux/if_tun.h> include not detected")
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    12
    else:
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    13
        conf.report_optional_feature("TapBridge", "Tap Bridge",
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    14
                                     False,
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    15
                                     "needs threading support which is not available")
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    16
5975
c85cb9b073a0 comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents: 4390
diff changeset
    17
    if conf.env['ENABLE_TAP']:
7487
82cd20da9650 Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7294
diff changeset
    18
        blddir = os.path.abspath(os.path.join(conf.bldnode.abspath(), conf.variant))
7244
1a9428ead071 fixed paths to tap-creator and emu-sock-creator broken after modules move.
Andrey Mazo <mazo@iitp.ru>
parents: 6982
diff changeset
    19
        tapcreatordir = os.path.abspath(os.path.join(blddir, "src/tap-bridge"))
5975
c85cb9b073a0 comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents: 4390
diff changeset
    20
        conf.env.append_value('NS3_EXECUTABLE_PATH', tapcreatordir)
7294
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    21
    else:
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    22
        # Add this module to the list of modules that won't be built
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    23
        # if they are enabled.
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    24
        conf.env['MODULES_NOT_BUILT'].append('tap-bridge')
5975
c85cb9b073a0 comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents: 4390
diff changeset
    25
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    26
def build(bld):
7294
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    27
    # Don't do anything for this module if tap-bridge's not enabled.
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    28
    if not bld.env['ENABLE_TAP']:
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    29
        return
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    30
6836
638bb8c62285 Fix some additional dependency issues
Tom Henderson <tomh@tomh.org>
parents: 6823
diff changeset
    31
    module = bld.create_ns3_module('tap-bridge', ['network', 'internet'])
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    32
    module.source = [
7294
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    33
        'model/tap-bridge.cc',
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    34
        'model/tap-encode-decode.cc',
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    35
        'helper/tap-bridge-helper.cc',
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    36
        ]
7487
82cd20da9650 Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7294
diff changeset
    37
    headers = bld.new_task_gen(features=['ns3header'])
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    38
    headers.module = 'tap-bridge'
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    39
    headers.source = [
7294
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    40
        'model/tap-bridge.h',
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    41
        'helper/tap-bridge-helper.h',
6848
1f453ad50ef3 Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents: 6836
diff changeset
    42
        'doc/tap.h',
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    43
        ]
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    44
6982
c383b48d0831 Make sure modular python bindings for emu and tap-bridge are not built on macosx
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6932
diff changeset
    45
    if not bld.env['PLATFORM'].startswith('freebsd'):
c383b48d0831 Make sure modular python bindings for emu and tap-bridge are not built on macosx
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6932
diff changeset
    46
        obj = bld.create_suid_program('tap-creator')
c383b48d0831 Make sure modular python bindings for emu and tap-bridge are not built on macosx
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6932
diff changeset
    47
        obj.source = [
c383b48d0831 Make sure modular python bindings for emu and tap-bridge are not built on macosx
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6932
diff changeset
    48
            'model/tap-creator.cc',
c383b48d0831 Make sure modular python bindings for emu and tap-bridge are not built on macosx
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6932
diff changeset
    49
            'model/tap-encode-decode.cc',
c383b48d0831 Make sure modular python bindings for emu and tap-bridge are not built on macosx
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6932
diff changeset
    50
            ]
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    51
6848
1f453ad50ef3 Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents: 6836
diff changeset
    52
    if bld.env['ENABLE_EXAMPLES']:
1f453ad50ef3 Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents: 6836
diff changeset
    53
        bld.add_subdirs('examples')
6932
3b497f4f6ad9 Add more modular bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6852
diff changeset
    54
3b497f4f6ad9 Add more modular bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6852
diff changeset
    55
    bld.ns3_python_bindings()