source: rtems-libbsd/waf_generator.py @ a76483d

55-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since a76483d was a76483d, checked in by Sebastian Huber <sebastian.huber@…>, on 11/13/15 at 09:58:45

Use latest rtems_waf

  • Property mode set to 100755
File size: 25.7 KB
Line 
1#
2#  Copyright (c) 2015 Chris Johns <chrisj@rtems.org>. All rights reserved.
3#
4#  Copyright (c) 2009-2015 embedded brains GmbH.  All rights reserved.
5#
6#   embedded brains GmbH
7#   Dornierstr. 4
8#   82178 Puchheim
9#   Germany
10#   <info@embedded-brains.de>
11#
12#  Copyright (c) 2012 OAR Corporation. All rights reserved.
13#
14#  Redistribution and use in source and binary forms, with or without
15#  modification, are permitted provided that the following conditions
16#  are met:
17#  1. Redistributions of source code must retain the above copyright
18#     notice, this list of conditions and the following disclaimer.
19#  2. Redistributions in binary form must reproduce the above copyright
20#     notice, this list of conditions and the following disclaimer in the
21#     documentation and/or other materials provided with the distribution.
22#
23#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27#  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29#  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31#  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
35import os
36import tempfile
37
38import builder
39
40trace = False
41
42data = { }
43
44def _add_files(name, files):
45    if type(files) is not list:
46        files = [files]
47    if name not in data:
48        data[name] = []
49    data[name] += files
50
51def _clfags_includes(cflags, includes):
52    if type(cflags) is not list:
53        if cflags is not None:
54            _cflags = cflags.split(' ')
55        else:
56            _cflags = [None]
57    else:
58        _cflags = cflags
59    if type(includes) is not list:
60        _includes = [includes]
61    else:
62        _includes = includes
63    return _cflags, _includes
64
65class SourceFileFragmentComposer(builder.BuildSystemFragmentComposer):
66
67    def __init__(self, cflags = "default", includes = None):
68        self.cflags, self.includes = _clfags_includes(cflags, includes)
69
70    def compose(self, path):
71        if None in self.includes:
72            return ['sources', self.cflags], [path], self.cflags, self.includes
73        return ['sources', self.cflags + self.includes], [path], self.cflags, self.includes
74
75class TestFragementComposer(builder.BuildSystemFragmentComposer):
76
77    def __init__(self, testName, fileFragments, runTest = True, netTest = False):
78        self.testName = testName
79        self.fileFragments = fileFragments
80        self.runTest = runTest
81        self.netTest = netTest
82
83    def compose(self, path):
84        return ['tests', self.testName], { 'files': self.fileFragments,
85                                           'run': self.runTest,
86                                           'net': self.netTest }
87
88class KVMSymbolsFragmentComposer(builder.BuildSystemFragmentComposer):
89
90    def compose(self, path):
91        return ['KVMSymbols', 'files'], [path], self.includes
92
93class RPCGENFragmentComposer(builder.BuildSystemFragmentComposer):
94
95    def compose(self, path):
96        return ['RPCGen', 'files'], [path]
97
98class RouteKeywordsFragmentComposer(builder.BuildSystemFragmentComposer):
99
100    def compose(self, path):
101        return ['RouteKeywords', 'files'], [path]
102
103class LexFragmentComposer(builder.BuildSystemFragmentComposer):
104
105    def __init__(self, sym, dep, cflags = None, includes = None):
106        self.sym = sym
107        self.dep = dep
108        self.cflags, self.includes = _clfags_includes(cflags, includes)
109
110    def compose(self, path):
111        d = { 'file': path,
112              'sym': self.sym,
113              'dep': self.dep }
114        if None not in self.cflags:
115            d['cflags'] = self.cflags
116        if None not in self.includes:
117            d['includes'] = self.includes
118        return ['lex', path], d
119
120class YaccFragmentComposer(builder.BuildSystemFragmentComposer):
121
122    def __init__(self, sym, header, cflags = None, includes = None):
123        self.sym = sym
124        self.header = header
125        self.cflags, self.includes = _clfags_includes(cflags, includes)
126
127    def compose(self, path):
128        d = { 'file': path,
129              'sym': self.sym,
130              'header': self.header }
131        if None not in self.cflags:
132            d['cflags'] = self.cflags
133        if None not in self.includes:
134            d['includes'] = self.includes
135        return ['yacc', path], d
136
137# Module Manager - Collection of Modules
138class ModuleManager(builder.ModuleManager):
139
140    def restart(self):
141        self.script = ''
142
143    def add(self, line = ''):
144        self.script += line + os.linesep
145
146    def write(self):
147        try:
148            out = tempfile.NamedTemporaryFile(delete = False)
149            out.write(self.script)
150            out.close()
151            wscript = builder.RTEMS_DIR + '/wscript'
152            builder.processIfDifferent(out.name, wscript, "wscript")
153        finally:
154            try:
155                os.remove(out.name)
156            except:
157                pass
158
159    def setGenerators(self):
160        self.generator['convert'] = builder.Converter
161        self.generator['no-convert'] = builder.NoConverter
162
163        self.generator['file'] = builder.File
164
165        self.generator['path'] = builder.PathComposer
166        self.generator['freebsd-path'] = builder.FreeBSDPathComposer
167        self.generator['rtems-path'] = builder.RTEMSPathComposer
168        self.generator['cpu-path'] = builder.CPUDependentPathComposer
169        self.generator['target-src-cpu--path'] = builder.TargetSourceCPUDependentPathComposer
170
171        self.generator['source'] = SourceFileFragmentComposer
172        self.generator['test'] = TestFragementComposer
173        self.generator['kvm-symbols'] = KVMSymbolsFragmentComposer
174        self.generator['rpc-gen'] = RPCGENFragmentComposer
175        self.generator['route-keywords'] = RouteKeywordsFragmentComposer
176        self.generator['lex'] = LexFragmentComposer
177        self.generator['yacc'] = YaccFragmentComposer
178
179    def generate(self):
180
181        def _source_list(lhs, files, append = False):
182            if append:
183                adder = '+'
184                adder_space = ' '
185            else:
186                adder = ''
187                adder_space = ''
188            ll = len(lhs)
189            if len(files) == 1:
190                self.add('%s %s= [%r]' % (lhs, adder, files[0]))
191            elif len(files) == 2:
192                self.add('%s %s= [%r,' % (lhs, adder, files[0]))
193                self.add('%s %s   %r]' % (' ' * ll, adder_space, files[-1]))
194            elif len(files) > 0:
195                self.add('%s %s= [%r,' % (lhs, adder, files[0]))
196                for f in files[1:-1]:
197                    self.add('%s %s   %r,' % (' ' * ll, adder_space, f))
198                self.add('%s %s   %r]' % (' ' * ll, adder_space, files[-1]))
199
200        def _data_insert(data, cpu, frag):
201            #
202            # The default handler returns an empty string. Skip it.
203            #
204            if type(frag) is not str:
205                # Start at the top of the tree
206                d = data
207                path = frag[0]
208                if path[0] not in d:
209                    d[path[0]] = {}
210                # Select the sub-part of the tree as the compile options
211                # specialise how files are built.
212                d = d[path[0]]
213                if type(path[1]) is list:
214                    p = ' '.join(path[1])
215                else:
216                    p = path[1]
217                if p not in d:
218                    d[p] = {}
219                d = d[p]
220                if cpu not in d:
221                    d[cpu] = []
222                if type(frag[1]) is list:
223                    d[cpu] += frag[1]
224                else:
225                    d[cpu] = frag[1]
226                if len(frag) > 3:
227                    if 'cflags' not in d[cpu]:
228                        d['cflags'] = []
229                    d['cflags'] += frag[2]
230                if len(frag) >= 3 and None not in frag[-1]:
231                    if 'includes' not in d[cpu]:
232                        d['includes'] = []
233                    d['includes'] += frag[-1]
234
235        data = { }
236
237        for mn in self.getModules():
238            m = self[mn]
239            if m.conditionalOn == "none":
240                for f in m.files:
241                    _data_insert(data, 'all', f.getFragment())
242            for cpu, files in sorted(m.cpuDependentSourceFiles.items()):
243                for f in files:
244                    _data_insert(data, cpu, f.getFragment())
245
246        if trace:
247            import pprint
248            pprint.pprint(data)
249
250        self.restart()
251
252        self.add('#')
253        self.add('# RTEMS Project (https://www.rtems.org)')
254        self.add('#')
255        self.add('# Generated waf script. Do not edit, run ./freebsd-to-rtems.py -m')
256        self.add('#')
257        self.add('# To use see README.waf shipped with this file.')
258        self.add('#')
259        self.add('')
260        self.add('import os.path')
261        self.add('')
262        self.add('try:')
263        self.add('    import rtems_waf.rtems as rtems')
264        self.add('except:')
265        self.add('    print("error: no rtems_waf git submodule; see README.waf")')
266        self.add('    import sys')
267        self.add('    sys.exit(1)')
268        self.add('')
269        self.add('def init(ctx):')
270        self.add('    rtems.init(ctx)')
271        self.add('')
272        self.add('def options(opt):')
273        self.add('    rtems.options(opt)')
274        self.add('    opt.add_option("--enable-auto-regen",')
275        self.add('                   action = "store_true",')
276        self.add('                   default = False,')
277        self.add('                   dest = "auto_regen",')
278        self.add('                   help = "Enable auto-regeneration of LEX, RPC and YACC files.")')
279        self.add('    opt.add_option("--enable-warnings",')
280        self.add('                   action = "store_true",')
281        self.add('                   default = False,')
282        self.add('                   dest = "warnings",')
283        self.add('                   help = "Enable all warnings. The default is quiet builds.")')
284        self.add('    opt.add_option("--net-test-config",')
285        self.add('                   default = "config.inc",')
286        self.add('                   dest = "net_config",')
287        self.add('                   help = "Network test configuration.")')
288        self.add('')
289        self.add('def bsp_configure(conf, arch_bsp):')
290        self.add('    conf.check(header_name = "dlfcn.h", features = "c")')
291        self.add('    conf.check(header_name = "rtems/pci.h", features = "c", mandatory = False)')
292        self.add('    if not rtems.check_posix(conf):')
293        self.add('        conf.fatal("RTEMS kernel POSIX support is disabled; configure RTEMS with --enable-posix")')
294        self.add('    if rtems.check_networking(conf):')
295        self.add('        conf.fatal("RTEMS kernel contains the old network support; configure RTEMS with --disable-networking")')
296        self.add('')
297        self.add('def configure(conf):')
298        self.add('    if conf.options.auto_regen:')
299        self.add('        conf.find_program("lex", mandatory = True)')
300        self.add('        conf.find_program("rpcgen", mandatory = True)')
301        self.add('        conf.find_program("yacc", mandatory = True)')
302        self.add('    conf.env.AUTO_REGEN = conf.options.auto_regen')
303        self.add('    conf.env.WARNINGS = conf.options.warnings')
304        self.add('    conf.env.NET_CONFIG = conf.options.net_config')
305        self.add('    rtems.configure(conf, bsp_configure)')
306        self.add('')
307        self.add('def build(bld):')
308        self.add('    rtems.build(bld)')
309        self.add('')
310        self.add('    # C/C++ flags')
311        self.add('    common_flags = []')
312        for f in builder.common_flags():
313            self.add('    common_flags += ["%s"]' % (f))
314        self.add('    if bld.env.WARNINGS:')
315        for f in builder.common_warnings():
316            self.add('        common_flags += ["%s"]' % (f))
317        self.add('    else:')
318        for f in builder.common_no_warnings():
319            self.add('        common_flags += ["%s"]' % (f))
320        self.add('    cflags = %r + common_flags' % (builder.cflags()))
321        self.add('    cxxflags = %r + common_flags' % (builder.cxxflags()))
322        self.add('')
323        self.add('    # Include paths')
324        self.add('    includes = []')
325        self.add('    for i in %r:' % (builder.cpu_includes()))
326        self.add('        includes += ["%s" % (i[2:].replace("@CPU@", bld.get_env()["RTEMS_ARCH"]))]')
327        self.add('    if bld.get_env()["RTEMS_ARCH"] == "i386":')
328        self.add('        for i in %r:' % (builder.cpu_includes()))
329        self.add('            includes += ["%s" % (i[2:].replace("@CPU@", "x86"))]')
330        for i in builder.includes():
331            self.add('    includes += ["%s"]' % (i[2:]))
332        self.add('')
333        self.add('    # Support dummy PIC IRQ includes')
334        self.add('    if bld.get_env()["RTEMS_ARCH"] not in ("arm", "i386", "lm32", "mips", "powerpc", "sparc", "m68k"):')
335        self.add('        includes += ["rtems-dummy-pic-irq/include"]')
336        self.add('')
337
338        self.add('    # Collect the libbsd uses')
339        self.add('    libbsd_use = []')
340        self.add('')
341
342        #
343        # Support the existing Makefile based network configuration file.
344        #
345        self.add('    # Network test configuration')
346        self.add('    if not os.path.exists(bld.env.NET_CONFIG):')
347        self.add('        bld.fatal("network configuraiton \'%s\' not found" % (bld.env.NET_CONFIG))')
348        self.add('    net_cfg_self_ip = None')
349        self.add('    net_cfg_netmask = None')
350        self.add('    net_cfg_peer_ip = None')
351        self.add('    net_cfg_gateway_ip = None')
352        self.add('    net_tap_interface = None')
353        self.add('    try:')
354        self.add('        net_cfg_lines = open(bld.env.NET_CONFIG).readlines()')
355        self.add('    except:')
356        self.add('        bld.fatal("network configuraiton \'%s\' read failed" % (bld.env.NET_CONFIG))')
357        self.add('    lc = 0')
358        self.add('    for l in net_cfg_lines:')
359        self.add('        lc += 1')
360        self.add('        if l.strip().startswith("NET_CFG_"):')
361        self.add('            ls = l.split("=")')
362        self.add('            if len(ls) != 2:')
363        self.add('                bld.fatal("network configuraiton \'%s\' parse error: %d: %s" % ' + \
364                 '(bld.env.NET_CONFIG, lc, l))')
365        self.add('            lhs = ls[0].strip()')
366        self.add('            rhs = ls[1].strip()')
367        self.add('            if lhs == "NET_CFG_SELF_IP":')
368        self.add('                net_cfg_self_ip = rhs')
369        self.add('            if lhs == "NET_CFG_NETMASK":')
370        self.add('                net_cfg_netmask = rhs')
371        self.add('            if lhs == "NET_CFG_PEER_IP":')
372        self.add('                net_cfg_peer_ip = rhs')
373        self.add('            if lhs == "NET_CFG_GATEWAY_IP":')
374        self.add('                net_cfg_gateway_ip = rhs')
375        self.add('            if lhs == "NET_TAP_INTERFACE":')
376        self.add('                net_tap_interface = rhs')
377        self.add('    bld(target = "testsuite/include/rtems/bsd/test/network-config.h",')
378        self.add('        source = "testsuite/include/rtems/bsd/test/network-config.h.in",')
379        self.add('        rule = "sed -e \'s/@NET_CFG_SELF_IP@/%s/\' ' + \
380                 '-e \'s/@NET_CFG_NETMASK@/%s/\' ' + \
381                 '-e \'s/@NET_CFG_PEER_IP@/%s/\' ' + \
382                 '-e \'s/@NET_CFG_GATEWAY_IP@/%s/\' < ${SRC} > ${TGT}" % ' + \
383                 '(net_cfg_self_ip, net_cfg_netmask, net_cfg_peer_ip, net_cfg_gateway_ip),')
384        self.add('        update_outputs = True)')
385        self.add('')
386
387        #
388        # Add the specific rule based builders for generating files.
389        #
390        if 'KVMSymbols' in data:
391            kvmsymbols = data['KVMSymbols']
392            if 'includes' in kvmsymbols['files']:
393                includes = kvmsymbols['files']['includes']
394            else:
395                includes = []
396            self.add('    # KVM Symbols')
397            self.add('    bld(target = "%s",' % (kvmsymbols['files']['all'][0]))
398            self.add('        source = "rtemsbsd/rtems/generate_kvm_symbols",')
399            self.add('        rule = "./${SRC} > ${TGT}",')
400            self.add('        update_outputs = True)')
401            self.add('    bld.objects(target = "kvmsymbols",')
402            self.add('                features = "c",')
403            self.add('                cflags = cflags,')
404            self.add('                includes = %r + includes,' % (includes))
405            self.add('                source = "%s")' % (kvmsymbols['files']['all'][0]))
406            self.add('    libbsd_use += ["kvmsymbols"]')
407            self.add('')
408
409        self.add('    bld.add_group()')
410
411        if 'RPCGen' in data:
412            rpcgen = data['RPCGen']
413            rpcname = rpcgen['files']['all'][0][:-2]
414            self.add('    # RPC Generation')
415            self.add('    if bld.env.AUTO_REGEN:')
416            self.add('        bld(target = "%s.h",' % (rpcname))
417            self.add('            source = "%s.x",' % (rpcname))
418            self.add('            rule = "${RPCGEN} -h -o ${TGT} ${SRC}")')
419            self.add('')
420
421        if 'RouteKeywords' in data:
422            routekw = data['RouteKeywords']
423            rkwname = routekw['files']['all'][0]
424            self.add('    # Route keywords')
425            self.add('    if bld.env.AUTO_REGEN:')
426            self.add('        rkw_rule = "cat ${SRC} | ' + \
427                     'awk \'BEGIN { r = 0 } { if (NF == 1) ' + \
428                     'printf \\"#define\\\\tK_%%s\\\\t%%d\\\\n\\\\t{\\\\\\"%%s\\\\\\", K_%%s},\\\\n\\", ' + \
429                     'toupper($1), ++r, $1, toupper($1)}\' > ${TGT}"')
430            self.add('        bld(target = "%s.h",' % (rkwname))
431            self.add('            source = "%s",' % (rkwname))
432            self.add('            rule = rkw_rule)')
433            self.add('')
434
435        if 'lex' in data:
436            lexes = data['lex']
437            self.add('    # Lex')
438            for l in lexes:
439                lex = lexes[l]['all']
440                if 'cflags' in lex:
441                    lex_defines = [d[2:] for d in lex['cflags']]
442                else:
443                    lex_defines = []
444                if 'includes' in lex:
445                    lex_includes = lex['includes']
446                else:
447                    lex_includes = []
448                self.add('    if bld.env.AUTO_REGEN:')
449                self.add('        bld(target = "%s.c",' % (lex['file'][:-2]))
450                self.add('            source = "%s",' % (lex['file']))
451                self.add('            rule = "${LEX} -P %s -t ${SRC} | ' % (lex['sym']) + \
452                         'sed -e \'/YY_BUF_SIZE/s/16384/1024/\' > ${TGT}")')
453                self.add('    bld.objects(target = "lex_%s",' % (lex['sym']))
454                self.add('                features = "c",')
455                self.add('                cflags = cflags,')
456                self.add('                includes = %r + includes,' % (lex_includes))
457                self.add('                defines = %r,' % (lex_defines))
458                self.add('                source = "%s.c")' % (lex['file'][:-2]))
459                self.add('    libbsd_use += ["lex_%s"]' % (lex['sym']))
460                self.add('')
461
462        if 'yacc' in data:
463            yaccs = data['yacc']
464            self.add('    # Yacc')
465            for y in yaccs:
466                yacc = yaccs[y]['all']
467                yacc_file = yacc['file']
468                if yacc['sym'] is not None:
469                    yacc_sym = yacc['sym']
470                else:
471                    yacc_sym = os.path.basename(yacc_file)[:-2]
472                yacc_header = '%s/%s' % (os.path.dirname(yacc_file), yacc['header'])
473                if 'cflags' in yacc:
474                    yacc_defines = [d[2:] for d in yacc['cflags']]
475                else:
476                    yacc_defines = []
477                if 'includes' in yacc:
478                    yacc_includes = yacc['includes']
479                else:
480                    yacc_includes = []
481                self.add('    if bld.env.AUTO_REGEN:')
482                self.add('        bld(target = "%s.c",' % (yacc_file[:-2]))
483                self.add('            source = "%s",' % (yacc_file))
484                self.add('            rule = "${YACC} -b %s -d -p %s ${SRC} && ' % (yacc_sym, yacc_sym) + \
485                         'sed -e \'/YY_BUF_SIZE/s/16384/1024/\' < %s.tab.c > ${TGT} && ' % (yacc_sym) + \
486                         'rm -f %s.tab.c && mv %s.tab.h %s")' % (yacc_sym, yacc_sym, yacc_header))
487                self.add('    bld.objects(target = "yacc_%s",' % (yacc_sym))
488                self.add('                features = "c",')
489                self.add('                cflags = cflags,')
490                self.add('                includes = %r + includes,' % (yacc_includes))
491                self.add('                defines = %r,' % (yacc_defines))
492                self.add('                source = "%s.c")' % (yacc_file[:-2]))
493                self.add('    libbsd_use += ["yacc_%s"]' % (yacc_sym))
494            self.add('')
495
496        #
497        # We have 'm' different sets of flags and there can be 'n' cpus
498        # specific files for those flags.
499        #
500        objs = 0
501        self.add('    # Objects built with different CFLAGS')
502        for flags in sorted(data['sources']):
503            if flags is not 'default':
504                objs += 1
505                _source_list('    objs%02d_source' % objs, sorted(data['sources'][flags]['all']))
506                archs = sorted(data['sources'][flags])
507                for arch in archs:
508                    if arch not in ['all', 'cflags', 'includes']:
509                        self.add('    if bld.get_env()["RTEMS_ARCH"] == "%s":' % arch)
510                        _source_list('        objs%02d_source' % objs,
511                                     sorted(data['sources'][flags][arch]),
512                                     append = True)
513                if 'cflags' in data['sources'][flags]:
514                    defines = [d[2:] for d in data['sources'][flags]['cflags']]
515                else:
516                    defines = []
517                if 'includes' in data['sources'][flags]:
518                    includes = data['sources'][flags]['includes']
519                else:
520                    includes = []
521                self.add('    bld.objects(target = "objs%02d",' % (objs))
522                self.add('                features = "c",')
523                self.add('                cflags = cflags,')
524                self.add('                includes = %r + includes,' % (includes))
525                self.add('                defines = %r,' % (defines))
526                self.add('                source = objs%02d_source)' % objs)
527                self.add('    libbsd_use += ["objs%02d"]' % (objs))
528                self.add('')
529
530        #
531        # We hold the 'default' cflags set of files to the end to create the
532        # static library with.
533        #
534        _source_list('    source', sorted(data['sources']['default']['all']))
535        archs = sorted(data['sources']['default'])
536        for arch in archs:
537            if arch is not 'all':
538                self.add('    if bld.get_env()["RTEMS_ARCH"] == "%s":' % arch)
539                _source_list('        source',
540                             sorted(data['sources']['default'][arch]),
541                             append = True)
542        self.add('    bld.stlib(target = "bsd",')
543        self.add('              features = "c cxx",')
544        self.add('              cflags = cflags,')
545        self.add('              cxxflags = cxxflags,')
546        self.add('              includes = includes,')
547        self.add('              source = source,')
548        self.add('              use = libbsd_use)')
549        self.add('')
550
551        #
552        # Head file collector.
553        #
554        self.add('    # Installs.    ')
555        self.add('    bld.install_files("${PREFIX}/" + rtems.arch_bsp_lib_path(bld.env.RTEMS_VERSION, bld.env.RTEMS_ARCH_BSP), ["libbsd.a"])')
556        header_paths = builder.header_paths()
557        self.add('    header_paths = [%s,' % (str(header_paths[0])))
558        for hp in header_paths[1:-1]:
559            self.add('                     %s,' % (str(hp)))
560        self.add('                     %s]' % (str(header_paths[-1])))
561        self.add('    for headers in header_paths:')
562        self.add('        ipath = os.path.join(rtems.arch_bsp_include_path(bld.env.RTEMS_VERSION, bld.env.RTEMS_ARCH_BSP), headers[2])')
563        self.add('        start_dir = bld.path.find_dir(headers[0])')
564        self.add('        bld.install_files("${PREFIX}/" + ipath,')
565        self.add('                          start_dir.ant_glob("**/" + headers[1]),')
566        self.add('                          cwd = start_dir,')
567        self.add('                          relative_trick = True)')
568        self.add('')
569
570        self.add('    # Tests')
571        tests = data['tests']
572        for test_name in tests:
573            files = ['testsuite/%s/%s.c' % (test_name, f) for f in  data['tests'][test_name]['all']['files']]
574            _source_list('    test_%s' % (test_name), sorted(files))
575            self.add('    bld.program(target = "%s",' % (test_name))
576            self.add('                features = "cprogram",')
577            self.add('                cflags = cflags,')
578            self.add('                includes = includes,')
579            self.add('                source = test_%s,' % (test_name))
580            self.add('                use = ["bsd"],')
581            self.add('                lib = ["m", "z"],')
582            self.add('                install_path = None)')
583            self.add('')
584
585        self.write()
Note: See TracBrowser for help on using the repository browser.