author | Gustavo J. A. M. Carneiro <gjc@inescporto.pt> |
Fri, 04 Jul 2008 15:39:24 +0100 | |
changeset 3439 | a64d1da0d6bf |
parent 3260 | 8c0ab08144e6 |
child 3498 | ce35418645e9 |
permissions | -rw-r--r-- |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
1 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
2 |
|
761
0ffbc9fa8ef0
Define env['NS3_MODULE_PATH'] in configure rather than build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
693
diff
changeset
|
3 |
import os, os.path |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
4 |
import shutil |
1217
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1214
diff
changeset
|
5 |
import types |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
6 |
|
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
7 |
import Action |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
8 |
import Common |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
9 |
import Object |
600
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
10 |
import Params |
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
11 |
|
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
12 |
|
969
3c3ce40492a6
WAF: make list of modules (all_modules) a tuple instead of list, because it is hashable, and this way newer WAF is able to notice changes in it and automatically trigger a reconfiguration.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
968
diff
changeset
|
13 |
all_modules = ( |
600
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
14 |
'core', |
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
15 |
'common', |
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
16 |
'simulator', |
1878
f947cd18f0bb
Create a new contrib module; move event-garbage-collector.{h,cc} to the contrib module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1877
diff
changeset
|
17 |
'contrib', |
600
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
18 |
'node', |
3260
8c0ab08144e6
bug 186: internet-node directory must be renamed to internet-stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3063
diff
changeset
|
19 |
'internet-stack', |
972
6946c8237a73
src/devices/p2p -> src/devices/point-to-point
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
969
diff
changeset
|
20 |
'devices/point-to-point', |
1272 | 21 |
'devices/csma', |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
1306
diff
changeset
|
22 |
'applications/onoff', |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
1306
diff
changeset
|
23 |
'applications/packet-sink', |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
1306
diff
changeset
|
24 |
'applications/udp-echo', |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
969
diff
changeset
|
25 |
'routing/olsr', |
1120 | 26 |
'routing/global-routing', |
968
70d02500c9d5
mobility models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
955
diff
changeset
|
27 |
'mobility', |
1882
061f7f7f9992
start of work towards port of wifi code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1272
diff
changeset
|
28 |
'devices/wifi', |
2603
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2178
diff
changeset
|
29 |
'helper', |
3439
a64d1da0d6bf
Start of a BridgeNetDevice; for now does not yet do the 'learning' part, and does not preserve the source address of mac frames.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3260
diff
changeset
|
30 |
'devices/bridge', |
969
3c3ce40492a6
WAF: make list of modules (all_modules) a tuple instead of list, because it is hashable, and this way newer WAF is able to notice changes in it and automatically trigger a reconfiguration.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
968
diff
changeset
|
31 |
) |
600
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
32 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
33 |
def set_options(opt): |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
34 |
opt.sub_options('simulator') |
955
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
35 |
|
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
36 |
opt.add_option('--enable-rpath', |
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
37 |
help=("Link programs with rpath" |
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
38 |
" (normally not needed, see " |
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
39 |
" --run and --shell; moreover, only works in some" |
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
40 |
" specific platforms, such as Linux and Solaris)"), |
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
41 |
action="store_true", dest='enable_rpath', default=False) |
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
42 |
|
1858
68e1964c19e8
WAF: add a new --enable-modules configure option, to tell WAF to build only the specified set of ns-3 modules and its dependencies; programs depending on those modules are automatically excluded from the build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1747
diff
changeset
|
43 |
opt.add_option('--enable-modules', |
68e1964c19e8
WAF: add a new --enable-modules configure option, to tell WAF to build only the specified set of ns-3 modules and its dependencies; programs depending on those modules are automatically excluded from the build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1747
diff
changeset
|
44 |
help=("Build only these modules (and dependencies)"), |
68e1964c19e8
WAF: add a new --enable-modules configure option, to tell WAF to build only the specified set of ns-3 modules and its dependencies; programs depending on those modules are automatically excluded from the build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1747
diff
changeset
|
45 |
dest='enable_modules') |
68e1964c19e8
WAF: add a new --enable-modules configure option, to tell WAF to build only the specified set of ns-3 modules and its dependencies; programs depending on those modules are automatically excluded from the build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1747
diff
changeset
|
46 |
|
955
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
47 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
48 |
def configure(conf): |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
49 |
conf.sub_config('core') |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
50 |
conf.sub_config('simulator') |
3063
a1c532e3bf18
a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3001
diff
changeset
|
51 |
conf.sub_config('contrib') |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
52 |
|
761
0ffbc9fa8ef0
Define env['NS3_MODULE_PATH'] in configure rather than build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
693
diff
changeset
|
53 |
blddir = os.path.abspath(os.path.join(conf.m_blddir, conf.env.variant())) |
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1878
diff
changeset
|
54 |
conf.env['NS3_MODULE_PATH'] = [blddir] |
1306
8834e434187f
Build the ns3 library in the build/<variant> root, not in build/<variant>/src.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1272
diff
changeset
|
55 |
if Params.g_options.enable_rpath: |
8834e434187f
Build the ns3 library in the build/<variant> root, not in build/<variant>/src.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1272
diff
changeset
|
56 |
conf.env.append_value('RPATH', '-Wl,-rpath=%s' % (os.path.join(blddir),)) |
761
0ffbc9fa8ef0
Define env['NS3_MODULE_PATH'] in configure rather than build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
693
diff
changeset
|
57 |
|
928
218063b19458
WAF: derive the variable NS3_MODULES from the 'all_modules' list in src/wscript, instead of requiring every module to define a configure function to register themselves. This way module registration is done in one place only: src/wscript. Requires module naming conventions, though.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
770
diff
changeset
|
58 |
## Used to link the 'run-tests' program with all of ns-3 code |
218063b19458
WAF: derive the variable NS3_MODULES from the 'all_modules' list in src/wscript, instead of requiring every module to define a configure function to register themselves. This way module registration is done in one place only: src/wscript. Requires module naming conventions, though.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
770
diff
changeset
|
59 |
conf.env['NS3_MODULES'] = ['ns3-' + module.split('/')[-1] for module in all_modules] |
218063b19458
WAF: derive the variable NS3_MODULES from the 'all_modules' list in src/wscript, instead of requiring every module to define a configure function to register themselves. This way module registration is done in one place only: src/wscript. Requires module naming conventions, though.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
770
diff
changeset
|
60 |
|
1858
68e1964c19e8
WAF: add a new --enable-modules configure option, to tell WAF to build only the specified set of ns-3 modules and its dependencies; programs depending on those modules are automatically excluded from the build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1747
diff
changeset
|
61 |
|
1217
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1214
diff
changeset
|
62 |
def create_ns3_module(bld, name, dependencies=()): |
1220
4933e0890acd
Build all modules as a single ns3 shared library.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1217
diff
changeset
|
63 |
module = bld.create_obj('cpp', 'objects') |
1217
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1214
diff
changeset
|
64 |
module.name = 'ns3-' + name |
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1214
diff
changeset
|
65 |
module.target = module.name |
1220
4933e0890acd
Build all modules as a single ns3 shared library.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1217
diff
changeset
|
66 |
module.add_objects = ['ns3-' + dep for dep in dependencies] |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
67 |
module.module_deps = list(dependencies) |
1220
4933e0890acd
Build all modules as a single ns3 shared library.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1217
diff
changeset
|
68 |
module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS']) |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
69 |
module.env.append_value('CXXDEFINES', "NS3_MODULE_COMPILATION") |
1217
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1214
diff
changeset
|
70 |
return module |
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1214
diff
changeset
|
71 |
|
955
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
72 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
73 |
def build(bld): |
3001
f7aa2796627f
WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2750
diff
changeset
|
74 |
#Object.register('ns3header', Ns3Header) |
954
a54d59850d03
WAF: use a separate 'waf task' for installing each public ns3 header to work around a dependency tracking bug in waf causing too many rebuilds when a single header file changes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
928
diff
changeset
|
75 |
Action.Action('ns3header', func=_ns3_headers_inst, color='BLUE') |
3001
f7aa2796627f
WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2750
diff
changeset
|
76 |
#Object.register('ns3-module-header', Ns3ModuleHeader) |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
77 |
Action.Action('gen-ns3-module-header', func=gen_ns3_module_header, color='BLUE') |
1217
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1214
diff
changeset
|
78 |
bld.create_ns3_module = types.MethodType(create_ns3_module, bld) |
600
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
79 |
|
969
3c3ce40492a6
WAF: make list of modules (all_modules) a tuple instead of list, because it is hashable, and this way newer WAF is able to notice changes in it and automatically trigger a reconfiguration.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
968
diff
changeset
|
80 |
bld.add_subdirs(list(all_modules)) |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
81 |
|
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
82 |
for module in all_modules: |
3001
f7aa2796627f
WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2750
diff
changeset
|
83 |
modheader = bld.create_obj('ns3moduleheader') |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
84 |
modheader.module = module.split('/')[-1] |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
85 |
|
1220
4933e0890acd
Build all modules as a single ns3 shared library.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1217
diff
changeset
|
86 |
|
3001
f7aa2796627f
WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2750
diff
changeset
|
87 |
class ns3header_taskgen(Object.task_gen): |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
88 |
"""A set of NS-3 header files""" |
3001
f7aa2796627f
WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2750
diff
changeset
|
89 |
def __init__(self, *features): |
f7aa2796627f
WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2750
diff
changeset
|
90 |
Object.task_gen.__init__(self, *features) |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
91 |
self.inst_var = 'INCLUDEDIR' |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
92 |
self.inst_dir = 'ns3' |
1877
b2ebc493cd58
Add support for publishing ns3 headers in a subdir of ns3/ (we probably won't be needing this, but since it was implemented it might as well be commited, in case we ever need it)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
93 |
self.sub_dir = None # if not None, header files will be published as ns3/sub_dir/file.h |
2609
931d59bb1303
Add a 'module' attribute to the ns3header object specifying which module each set of headers belongs to.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2603
diff
changeset
|
94 |
self.module = None # module name |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
95 |
|
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
96 |
def apply(self): |
2609
931d59bb1303
Add a 'module' attribute to the ns3header object specifying which module each set of headers belongs to.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2603
diff
changeset
|
97 |
if self.module is None: |
931d59bb1303
Add a 'module' attribute to the ns3header object specifying which module each set of headers belongs to.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2603
diff
changeset
|
98 |
Params.fatal("'module' missing on ns3headers object %s" % self) |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
99 |
ns3_dir_node = Params.g_build.m_srcnode.find_dir("ns3") |
1877
b2ebc493cd58
Add support for publishing ns3 headers in a subdir of ns3/ (we probably won't be needing this, but since it was implemented it might as well be commited, in case we ever need it)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
100 |
if self.sub_dir is not None: |
b2ebc493cd58
Add support for publishing ns3 headers in a subdir of ns3/ (we probably won't be needing this, but since it was implemented it might as well be commited, in case we ever need it)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
101 |
ns3_dir_node = ns3_dir_node.find_dir(self.sub_dir) |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
102 |
for filename in self.to_list(self.source): |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
103 |
src_node = self.path.find_source(filename) |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
104 |
if src_node is None: |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
105 |
Params.fatal("source ns3 header file %s not found" % (filename,)) |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
106 |
dst_node = ns3_dir_node.find_build(os.path.basename(filename)) |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
107 |
assert dst_node is not None |
954
a54d59850d03
WAF: use a separate 'waf task' for installing each public ns3 header to work around a dependency tracking bug in waf causing too many rebuilds when a single header file changes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
928
diff
changeset
|
108 |
task = self.create_task('ns3header', self.env, 1) |
a54d59850d03
WAF: use a separate 'waf task' for installing each public ns3 header to work around a dependency tracking bug in waf causing too many rebuilds when a single header file changes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
928
diff
changeset
|
109 |
task.set_inputs([src_node]) |
a54d59850d03
WAF: use a separate 'waf task' for installing each public ns3 header to work around a dependency tracking bug in waf causing too many rebuilds when a single header file changes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
928
diff
changeset
|
110 |
task.set_outputs([dst_node]) |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
111 |
|
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
112 |
def install(self): |
1877
b2ebc493cd58
Add support for publishing ns3 headers in a subdir of ns3/ (we probably won't be needing this, but since it was implemented it might as well be commited, in case we ever need it)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
113 |
if self.sub_dir is None: |
b2ebc493cd58
Add support for publishing ns3 headers in a subdir of ns3/ (we probably won't be needing this, but since it was implemented it might as well be commited, in case we ever need it)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
114 |
inst_dir = self.inst_dir |
b2ebc493cd58
Add support for publishing ns3 headers in a subdir of ns3/ (we probably won't be needing this, but since it was implemented it might as well be commited, in case we ever need it)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
115 |
else: |
b2ebc493cd58
Add support for publishing ns3 headers in a subdir of ns3/ (we probably won't be needing this, but since it was implemented it might as well be commited, in case we ever need it)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
116 |
inst_dir = os.path.join(self.inst_dir, self.sub_dir) |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
117 |
for i in self.m_tasks: |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
118 |
current = Params.g_build.m_curdirnode |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
119 |
lst = map(lambda a: a.relpath_gen(current), i.m_outputs) |
1877
b2ebc493cd58
Add support for publishing ns3 headers in a subdir of ns3/ (we probably won't be needing this, but since it was implemented it might as well be commited, in case we ever need it)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
120 |
Common.install_files(self.inst_var, inst_dir, lst) |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
121 |
|
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
122 |
def _ns3_headers_inst(task): |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
123 |
assert len(task.m_inputs) == len(task.m_outputs) |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
124 |
inputs = [node.srcpath(task.m_env) for node in task.m_inputs] |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
125 |
outputs = [node.bldpath(task.m_env) for node in task.m_outputs] |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
126 |
for src, dst in zip(inputs, outputs): |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
127 |
try: |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
128 |
os.chmod(dst, 0600) |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
129 |
except OSError: |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
130 |
pass |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
131 |
shutil.copy2(src, dst) |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
132 |
## make the headers in builddir read-only, to prevent |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
133 |
## accidental modification |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
134 |
os.chmod(dst, 0400) |
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
135 |
return 0 |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
136 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
137 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
138 |
def gen_ns3_module_header(task): |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
139 |
assert len(task.m_outputs) == 1 |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
140 |
header_files = [os.path.basename(node.abspath(task.m_env)) for node in task.m_inputs] |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
141 |
outfile = file(task.m_outputs[0].bldpath(task.m_env), "w") |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
142 |
header_files.sort() |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
143 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
144 |
print >> outfile, """ |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
145 |
#ifdef NS3_MODULE_COMPILATION |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
146 |
# error "Do not include ns3 module aggregator headers from other modules; these are meant only for end user scripts." |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
147 |
#endif |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
148 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
149 |
#ifndef NS3_MODULE_%s |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
150 |
""" % (task.module.upper().replace('-', '_'),) |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
151 |
|
2750
87cebcbeb380
Don't generate module dependencies includes in module headers.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2611
diff
changeset
|
152 |
# if task.module_deps: |
87cebcbeb380
Don't generate module dependencies includes in module headers.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2611
diff
changeset
|
153 |
# print >> outfile, "// Module dependencies:" |
87cebcbeb380
Don't generate module dependencies includes in module headers.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2611
diff
changeset
|
154 |
# for dep in task.module_deps: |
87cebcbeb380
Don't generate module dependencies includes in module headers.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2611
diff
changeset
|
155 |
# print >> outfile, "#include \"%s-module.h\"" % dep |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
156 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
157 |
print >> outfile |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
158 |
print >> outfile, "// Module headers:" |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
159 |
for header in header_files: |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
160 |
print >> outfile, "#include \"%s\"" % (header,) |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
161 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
162 |
print >> outfile, "#endif" |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
163 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
164 |
outfile.close() |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
165 |
return 0 |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
166 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
167 |
|
3001
f7aa2796627f
WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2750
diff
changeset
|
168 |
class ns3moduleheader_taskgen(Object.task_gen): |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
169 |
""" |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
170 |
Generates a 'ns3/foo-module.h' header file that includes all |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
171 |
public ns3 headers of a certain module. |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
172 |
""" |
3001
f7aa2796627f
WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2750
diff
changeset
|
173 |
def __init__(self, *features): |
f7aa2796627f
WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2750
diff
changeset
|
174 |
Object.task_gen.__init__(self, *features) |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
175 |
self.module_name = None |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
176 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
177 |
def apply(self): |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
178 |
## get all of the ns3 headers |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
179 |
ns3_dir_node = Params.g_build.m_srcnode.find_dir("ns3") |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
180 |
all_headers_inputs = [] |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
181 |
for ns3headers in Object.g_allobjs: |
3001
f7aa2796627f
WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2750
diff
changeset
|
182 |
if isinstance(ns3headers, ns3header_taskgen): |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
183 |
if ns3headers.module != self.module: |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
184 |
continue |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
185 |
for source in ns3headers.to_list(ns3headers.source): |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
186 |
source = os.path.basename(source) |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
187 |
node = ns3_dir_node.find_build(os.path.basename(source)) |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
188 |
if node is None: |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
189 |
fatal("missing header file %s" % (source,)) |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
190 |
all_headers_inputs.append(node) |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
191 |
assert all_headers_inputs |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
192 |
module_obj = Object.name_to_obj("ns3-" + self.module) |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
193 |
assert module_obj is not None |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
194 |
all_headers_outputs = [ns3_dir_node.find_build("%s-module.h" % self.module)] |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
195 |
task = self.create_task('gen-ns3-module-header', self.env, 4) |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
196 |
task.set_inputs(all_headers_inputs) |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
197 |
task.set_outputs(all_headers_outputs) |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
198 |
task.module = self.module |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
199 |
task.module_deps = module_obj.module_deps |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
200 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
201 |
def install(self): |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
202 |
pass |