Changeset 93f1904 in rtems-libbsd


Ignore:
Timestamp:
Apr 25, 2018, 12:51:07 PM (13 months ago)
Author:
Christian Mauderer <christian.mauderer@…>
Branches:
b5f8d4831d66364b7391e3660560cb9bbecada2e, 31b5c87357cee83d6a3419c5d801a9bf16912714
Children:
4eb2502
Parents:
1588cf1
git-author:
Christian Mauderer <christian.mauderer@…> (04/25/18 12:51:07)
git-committer:
Christian Mauderer <christian.mauderer@…> (05/03/18 05:09:46)
Message:

waf: Generate a rtems/bsd/modules.h

The generated file defines a RTEMS_BSD_MODULE_xxx for each enabled
module. That is usefull for conditional compilation depending on whether
a module is build not.

Update #3351.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waf_libbsd.py

    r1588cf1 r93f1904  
    3838import sys
    3939import tempfile
     40import re
    4041
    4142import builder
     
    156157        #
    157158        config = self.getConfiguration()
     159        module_header_path = "rtems/bsd"
     160        module_header_name = "modules.h"
    158161
    159162        #
     
    256259                        source = header,
    257260                        is_copy = True)
     261
     262        #
     263        # Generate a header that contains information about enabled modules
     264        #
     265        def rtems_libbsd_modules_h_gen(self):
     266            output = ""
     267            output += '/*\n'
     268            output += ' * This file contains a list of modules that have been\n'
     269            output += ' * enabled during libbsd build. It is a generated file\n'
     270            output += ' * DO NOT EDIT MANUALLY.\n'
     271            output += ' */'
     272            output += '\n'
     273            output += '#ifndef RTEMS_BSD_MODULES_H\n'
     274            for mod in config['modules-enabled']:
     275                modname = re.sub("[^A-Za-z0-9]", "_", mod.upper())
     276                output += '#define RTEMS_BSD_MODULE_{} 1\n'.format(modname)
     277            output += '#endif /* RTEMS_BSD_MODULES_H */\n'
     278            self.outputs[0].write(output)
     279        modules_h_file_with_path = os.path.join(buildinclude,
     280                                                module_header_path,
     281                                                module_header_name)
     282        bld(rule = rtems_libbsd_modules_h_gen,
     283            target = modules_h_file_with_path,
     284            before = ['c', 'cxx'])
    258285
    259286        #
     
    458485                                      relative_trick = True)
    459486
     487        bld.install_files(os.path.join("${PREFIX}", arch_inc_path,
     488                                       module_header_path),
     489                          modules_h_file_with_path,
     490                          cwd = bld.path)
     491
    460492        #
    461493        # Tests
Note: See TracChangeset for help on using the changeset viewer.