source: rtems-libbsd/waf_generator.py @ 54409c7

4.1155-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since 54409c7 was 98d7c3c, checked in by Chris Johns <chrisj@…>, on 06/16/15 at 23:55:53

Check if RTEMS is built with POSIX.

  • Property mode set to 100755
File size: 25.4 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        for i in builder.includes():
326            self.add('    includes += ["%s"]' % (i[2:]))
327        self.add('    for i in %r:' % (builder.cpu_includes()))
328        self.add('        includes += ["%s" % (i[2:].replace("@CPU@", bld.get_env()["RTEMS_ARCH"]))]')
329        self.add('')
330        self.add('    # Support dummy PIC IRQ includes')
331        self.add('    if bld.get_env()["RTEMS_ARCH"] not in ("arm", "i386", "lm32", "mips", "powerpc", "sparc", "m68k"):')
332        self.add('        includes += ["rtems-dummy-pic-irq/include"]')
333        self.add('')
334
335        self.add('    # Collect the libbsd uses')
336        self.add('    libbsd_use = []')
337        self.add('')
338
339        #
340        # Support the existing Makefile based network configuration file.
341        #
342        self.add('    # Network test configuration')
343        self.add('    if not os.path.exists(bld.env.NET_CONFIG):')
344        self.add('        bld.fatal("network configuraiton \'%s\' not found" % (bld.env.NET_CONFIG))')
345        self.add('    net_cfg_self_ip = None')
346        self.add('    net_cfg_netmask = None')
347        self.add('    net_cfg_peer_ip = None')
348        self.add('    net_cfg_gateway_ip = None')
349        self.add('    net_tap_interface = None')
350        self.add('    try:')
351        self.add('        net_cfg_lines = open(bld.env.NET_CONFIG).readlines()')
352        self.add('    except:')
353        self.add('        bld.fatal("network configuraiton \'%s\' read failed" % (bld.env.NET_CONFIG))')
354        self.add('    lc = 0')
355        self.add('    for l in net_cfg_lines:')
356        self.add('        lc += 1')
357        self.add('        if l.strip().startswith("NET_CFG_"):')
358        self.add('            ls = l.split("=")')
359        self.add('            if len(ls) != 2:')
360        self.add('                bld.fatal("network configuraiton \'%s\' parse error: %d: %s" % ' + \
361                 '(bld.env.NET_CONFIG, lc, l))')
362        self.add('            lhs = ls[0].strip()')
363        self.add('            rhs = ls[1].strip()')
364        self.add('            if lhs == "NET_CFG_SELF_IP":')
365        self.add('                net_cfg_self_ip = rhs')
366        self.add('            if lhs == "NET_CFG_NETMASK":')
367        self.add('                net_cfg_netmask = rhs')
368        self.add('            if lhs == "NET_CFG_PEER_IP":')
369        self.add('                net_cfg_peer_ip = rhs')
370        self.add('            if lhs == "NET_CFG_GATEWAY_IP_IP":')
371        self.add('                net_cfg_gateway_ip = rhs')
372        self.add('            if lhs == "NET_TAP_INTERFACE_IP_IP":')
373        self.add('                net_tap_interface = rhs')
374        self.add('    bld(target = "testsuite/include/rtems/bsd/test/network-config.h",')
375        self.add('        source = "testsuite/include/rtems/bsd/test/network-config.h.in",')
376        self.add('        rule = "sed -e \'s/@NET_CFG_SELF_IP@/%s/\' ' + \
377                 '-e \'s/@NET_CFG_NETMASK@/%s/\' ' + \
378                 '-e \'s/@NET_CFG_PEER_IP@/%s/\' ' + \
379                 '-e \'s/@NET_CFG_GATEWAY_IP@/%s/\' < ${SRC} > ${TGT}" % ' + \
380                 '(net_cfg_self_ip, net_cfg_netmask, net_cfg_peer_ip, net_cfg_netmask),')
381        self.add('        update_outputs = True)')
382        self.add('')
383
384        #
385        # Add the specific rule based builders for generating files.
386        #
387        if 'KVMSymbols' in data:
388            kvmsymbols = data['KVMSymbols']
389            if 'includes' in kvmsymbols['files']:
390                includes = kvmsymbols['files']['includes']
391            else:
392                includes = []
393            self.add('    # KVM Symbols')
394            self.add('    bld(target = "%s",' % (kvmsymbols['files']['all'][0]))
395            self.add('        source = "rtemsbsd/rtems/generate_kvm_symbols",')
396            self.add('        rule = "./${SRC} > ${TGT}",')
397            self.add('        update_outputs = True)')
398            self.add('    bld.objects(target = "kvmsymbols",')
399            self.add('                features = "c",')
400            self.add('                cflags = cflags,')
401            self.add('                includes = %r + includes,' % (includes))
402            self.add('                source = "%s")' % (kvmsymbols['files']['all'][0]))
403            self.add('    libbsd_use += ["kvmsymbols"]')
404            self.add('')
405
406        self.add('    bld.add_group()')
407
408        if 'RPCGen' in data:
409            rpcgen = data['RPCGen']
410            rpcname = rpcgen['files']['all'][0][:-2]
411            self.add('    # RPC Generation')
412            self.add('    if bld.env.AUTO_REGEN:')
413            self.add('        bld(target = "%s.h",' % (rpcname))
414            self.add('            source = "%s.x",' % (rpcname))
415            self.add('            rule = "${RPCGEN} -h -o ${TGT} ${SRC}")')
416            self.add('')
417
418        if 'RouteKeywords' in data:
419            routekw = data['RouteKeywords']
420            rkwname = routekw['files']['all'][0]
421            self.add('    # Route keywords')
422            self.add('    if bld.env.AUTO_REGEN:')
423            self.add('        rkw_rule = "cat ${SRC} | ' + \
424                     'awk \'BEGIN { r = 0 } { if (NF == 1) ' + \
425                     'printf \\"#define\\\\tK_%%s\\\\t%%d\\\\n\\\\t{\\\\\\"%%s\\\\\\", K_%%s},\\\\n\\", ' + \
426                     'toupper($1), ++r, $1, toupper($1)}\' > ${TGT}"')
427            self.add('        bld(target = "%s.h",' % (rkwname))
428            self.add('            source = "%s",' % (rkwname))
429            self.add('            rule = rkw_rule)')
430            self.add('')
431
432        if 'lex' in data:
433            lexes = data['lex']
434            self.add('    # Lex')
435            for l in lexes:
436                lex = lexes[l]['all']
437                if 'cflags' in lex:
438                    lex_defines = [d[2:] for d in lex['cflags']]
439                else:
440                    lex_defines = []
441                if 'includes' in lex:
442                    lex_includes = lex['includes']
443                else:
444                    lex_includes = []
445                self.add('    if bld.env.AUTO_REGEN:')
446                self.add('        bld(target = "%s.c",' % (lex['file'][:-2]))
447                self.add('            source = "%s",' % (lex['file']))
448                self.add('            rule = "${LEX} -P %s -t ${SRC} | ' % (lex['sym']) + \
449                         'sed -e \'/YY_BUF_SIZE/s/16384/1024/\' > ${TGT}")')
450                self.add('    bld.objects(target = "lex_%s",' % (lex['sym']))
451                self.add('                features = "c",')
452                self.add('                cflags = cflags,')
453                self.add('                includes = %r + includes,' % (lex_includes))
454                self.add('                defines = %r,' % (lex_defines))
455                self.add('                source = "%s.c")' % (lex['file'][:-2]))
456                self.add('    libbsd_use += ["lex_%s"]' % (lex['sym']))
457                self.add('')
458
459        if 'yacc' in data:
460            yaccs = data['yacc']
461            self.add('    # Yacc')
462            for y in yaccs:
463                yacc = yaccs[y]['all']
464                yacc_file = yacc['file']
465                if yacc['sym'] is not None:
466                    yacc_sym = yacc['sym']
467                else:
468                    yacc_sym = os.path.basename(yacc_file)[:-2]
469                yacc_header = '%s/%s' % (os.path.dirname(yacc_file), yacc['header'])
470                if 'cflags' in yacc:
471                    yacc_defines = [d[2:] for d in yacc['cflags']]
472                else:
473                    yacc_defines = []
474                if 'includes' in yacc:
475                    yacc_includes = yacc['includes']
476                else:
477                    yacc_includes = []
478                self.add('    if bld.env.AUTO_REGEN:')
479                self.add('        bld(target = "%s.c",' % (yacc_file[:-2]))
480                self.add('            source = "%s",' % (yacc_file))
481                self.add('            rule = "${YACC} -b %s -d -p %s ${SRC} && ' % (yacc_sym, yacc_sym) + \
482                         'sed -e \'/YY_BUF_SIZE/s/16384/1024/\' < %s.tab.c > ${TGT} && ' % (yacc_sym) + \
483                         'rm -f %s.tab.c && mv %s.tab.h %s")' % (yacc_sym, yacc_sym, yacc_header))
484                self.add('    bld.objects(target = "yacc_%s",' % (yacc_sym))
485                self.add('                features = "c",')
486                self.add('                cflags = cflags,')
487                self.add('                includes = %r + includes,' % (yacc_includes))
488                self.add('                defines = %r,' % (yacc_defines))
489                self.add('                source = "%s.c")' % (yacc_file[:-2]))
490                self.add('    libbsd_use += ["yacc_%s"]' % (yacc_sym))
491            self.add('')
492
493        #
494        # We have 'm' different sets of flags and there can be 'n' cpus
495        # specific files for those flags.
496        #
497        objs = 0
498        self.add('    # Objects built with different CFLAGS')
499        for flags in sorted(data['sources']):
500            if flags is not 'default':
501                objs += 1
502                _source_list('    objs%02d_source' % objs, sorted(data['sources'][flags]['all']))
503                archs = sorted(data['sources'][flags])
504                for arch in archs:
505                    if arch not in ['all', 'cflags', 'includes']:
506                        self.add('    if bld.get_env()["RTEMS_ARCH"] == "%s":' % arch)
507                        _source_list('        objs%02d_source' % objs,
508                                     sorted(data['sources'][flags][arch]),
509                                     append = True)
510                if 'cflags' in data['sources'][flags]:
511                    defines = [d[2:] for d in data['sources'][flags]['cflags']]
512                else:
513                    defines = []
514                if 'includes' in data['sources'][flags]:
515                    includes = data['sources'][flags]['includes']
516                else:
517                    includes = []
518                self.add('    bld.objects(target = "objs%02d",' % (objs))
519                self.add('                features = "c",')
520                self.add('                cflags = cflags,')
521                self.add('                includes = %r + includes,' % (includes))
522                self.add('                defines = %r,' % (defines))
523                self.add('                source = objs%02d_source)' % objs)
524                self.add('    libbsd_use += ["objs%02d"]' % (objs))
525                self.add('')
526
527        #
528        # We hold the 'default' cflags set of files to the end to create the
529        # static library with.
530        #
531        _source_list('    source', sorted(data['sources']['default']['all']))
532        archs = sorted(data['sources']['default'])
533        for arch in archs:
534            if arch is not 'all':
535                self.add('    if bld.get_env()["RTEMS_ARCH"] == "%s":' % arch)
536                _source_list('        source',
537                             sorted(data['sources']['default'][arch]),
538                             append = True)
539        self.add('    bld.stlib(target = "bsd",')
540        self.add('              features = "c cxx",')
541        self.add('              cflags = cflags,')
542        self.add('              cxxflags = cxxflags,')
543        self.add('              includes = includes,')
544        self.add('              source = source,')
545        self.add('              use = libbsd_use)')
546        self.add('')
547
548        #
549        # Head file collector.
550        #
551        self.add('    # Installs.    ')
552        self.add('    bld.install_files("${PREFIX}/" + rtems.arch_bsp_lib_path(bld.env.RTEMS_ARCH_BSP), ["libbsd.a"])')
553        header_paths = builder.header_paths()
554        self.add('    header_paths = [%s,' % (str(header_paths[0])))
555        for hp in header_paths[1:-1]:
556            self.add('                     %s,' % (str(hp)))
557        self.add('                     %s]' % (str(header_paths[-1])))
558        self.add('    for headers in header_paths:')
559        self.add('        ipath = os.path.join(rtems.arch_bsp_include_path(bld.env.RTEMS_ARCH_BSP), headers[2])')
560        self.add('        start_dir = bld.path.find_dir(headers[0])')
561        self.add('        bld.install_files("${PREFIX}/" + ipath,')
562        self.add('                          start_dir.ant_glob("**/" + headers[1]),')
563        self.add('                          cwd = start_dir,')
564        self.add('                          relative_trick = True)')
565        self.add('')
566
567        self.add('    # Tests')
568        tests = data['tests']
569        for test_name in tests:
570            files = ['testsuite/%s/%s.c' % (test_name, f) for f in  data['tests'][test_name]['all']['files']]
571            _source_list('    test_%s' % (test_name), sorted(files))
572            self.add('    bld.program(target = "%s",' % (test_name))
573            self.add('                features = "cprogram",')
574            self.add('                cflags = cflags,')
575            self.add('                includes = includes,')
576            self.add('                source = test_%s,' % (test_name))
577            self.add('                use = ["bsd"],')
578            self.add('                lib = ["m", "z"],')
579            self.add('                install_path = None)')
580            self.add('')
581
582        self.write()
Note: See TracBrowser for help on using the repository browser.