Chris Johns 75ffa6781a python: Updates for Python 3.12
- Change SafeConfigParser to ConfigParser

- Fix escape sequences in strings

Updates #4968
2023-11-21 15:47:17 +11:00

182 lines
6.0 KiB
Python

#
# RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2014-2016 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
#
# RTEMS Linker build script.
#
import sys
def init(ctx):
pass
def options(opt):
opt.load('compiler_c')
opt.load('compiler_cxx')
def configure(conf):
conf.load('compiler_c')
conf.load('compiler_cxx')
conf.write_config_header('config.h')
def build(bld):
#
# Build the doxygen documentation.
#
if bld.cmd == 'doxy':
bld(features = 'doxygen',
doxyfile = 'rtl-host.conf')
return
#
# The local configuration.
#
conf = {}
#
# Build flags.
#
rtemstoolkit = '../rtemstoolkit'
conf['includes'] = [rtemstoolkit,
rtemstoolkit + '/elftoolchain/libelf',
rtemstoolkit + '/elftoolchain/libdwarf',
rtemstoolkit + '/elftoolchain/common',
rtemstoolkit + '/elftoolchain/libelftc',
rtemstoolkit + '/libiberty']
if bld.env.DEST_OS == 'win32':
conf['includes'] += [rtemstoolkit + '/win32']
conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic']
conf['optflags'] = bld.env.C_OPTS
conf['cflags'] = ['-pipe', '-g'] + conf['optflags']
conf['cxxflags'] = ['-pipe', '-g', '--std=c++11'] + conf['optflags']
conf['linkflags'] = ['-g']
#
# The list of modules.
#
modules = ['rld', 'elftc', 'dwarf', 'elf', 'iberty']
#
# The list of defines
#
defines = ['HAVE_CONFIG_H=1',
'RTEMS_VERSION=\"%s\"' % (bld.env.RTEMS_VERSION),
'RTEMS_RELEASE=\"%s\"' % (bld.env.RTEMS_RELEASE)]
#
# Build the linker.
#
bld.program(target = 'rtems-ld',
source = ['rtems-ld.cpp'],
defines = defines,
includes = ['.'] + conf['includes'],
cflags = conf['cflags'] + conf['warningflags'],
cxxflags = conf['cxxflags'] + conf['warningflags'],
linkflags = conf['linkflags'],
use = modules)
#
# Build the ra linker.
#
bld.program(target = 'rtems-ra',
source = ['rtems-ra.cpp'],
defines = defines,
includes = ['.'] + conf['includes'],
cflags = conf['cflags'] + conf['warningflags'],
cxxflags = conf['cxxflags'] + conf['warningflags'],
linkflags = conf['linkflags'],
use = modules)
#
# Build the trace linker.
#
bld.program(target = 'rtems-tld',
source = ['rtems-tld.cpp'],
defines = defines,
includes = ['.'] + conf['includes'],
cflags = conf['cflags'] + conf['warningflags'],
cxxflags = conf['cxxflags'] + conf['warningflags'],
linkflags = conf['linkflags'],
use = modules)
bld.install_files('${PREFIX}/share/rtems/trace-linker',
['libc.ini',
'libc-heap.ini',
'rtems.ini',
'rtems-api.ini',
'rtems-posix.ini',
'rtems-score.ini',
'rtems-score-object.ini',
'rtems-score-thread.ini',
'rtems-score-threadq.ini',
'rtems-score-heap.ini',
'rtld-base.ini',
'rtld-trace-buffer.ini',
'rtld-print.ini'])
#
# Build the symbols.
#
bld.program(target = 'rtems-syms',
source = ['rtems-syms.cpp'],
defines = defines,
includes = ['.'] + conf['includes'],
cflags = conf['cflags'] + conf['warningflags'],
cxxflags = conf['cxxflags'] + conf['warningflags'],
linkflags = conf['linkflags'],
use = modules)
#
# Build the RAP utility.
#
bld.program(target = 'rtems-rap',
source = ['rtems-rapper.cpp'],
defines = defines,
includes = ['.'] + conf['includes'],
cflags = conf['cflags'] + conf['warningflags'],
cxxflags = conf['cxxflags'] + conf['warningflags'],
linkflags = conf['linkflags'],
use = modules)
#
# Build the EXE information tool.
#
bld.program(target = 'rtems-exeinfo',
source = ['rtems-exeinfo.cpp'],
defines = defines,
includes = ['.'] + conf['includes'],
cflags = conf['cflags'] + conf['warningflags'],
cxxflags = conf['cxxflags'] + conf['warningflags'],
linkflags = conf['linkflags'],
use = modules)
#
# Build the address to line tool.
#
bld.program(target = 'rtems-addr2line',
source = ['rtems-addr2line.cpp'],
defines = defines,
includes = ['.'] + conf['includes'],
cflags = conf['cflags'] + conf['warningflags'],
cxxflags = conf['cxxflags'] + conf['warningflags'],
linkflags = conf['linkflags'],
use = modules)
def tags(ctx):
ctx.exec_command('etags $(find . -name \\*.[sSch])', shell = True)