[feaf877] | 1 | # |
---|
[051ef30] | 2 | # RTEMS Project (https://www.rtems.org/) |
---|
[8b10210] | 3 | # |
---|
[051ef30] | 4 | # Copyright (c) 2015-2016 Chris Johns <chrisj@rtems.org>. All rights reserved. |
---|
| 5 | # |
---|
| 6 | # Redistribution and use in source and binary forms, with or without |
---|
| 7 | # modification, are permitted provided that the following conditions |
---|
| 8 | # are met: |
---|
| 9 | # 1. Redistributions of source code must retain the above copyright |
---|
| 10 | # notice, this list of conditions and the following disclaimer. |
---|
| 11 | # 2. Redistributions in binary form must reproduce the above copyright |
---|
| 12 | # notice, this list of conditions and the following disclaimer in the |
---|
| 13 | # documentation and/or other materials provided with the distribution. |
---|
| 14 | # |
---|
| 15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
| 16 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
| 17 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
| 18 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
---|
| 19 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 20 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
| 21 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
| 22 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
| 23 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
| 24 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
---|
| 25 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 26 | |
---|
| 27 | # |
---|
| 28 | # RTEMS LibBSD is a transparent source build of the FreeBSD kernel source for RTEMS. |
---|
[8b10210] | 29 | # |
---|
| 30 | # To use see README.waf shipped with this file. |
---|
[feaf877] | 31 | # |
---|
| 32 | |
---|
[97c5024a] | 33 | from __future__ import print_function |
---|
| 34 | |
---|
[b15a719] | 35 | rtems_version = "5" |
---|
[97c5024a] | 36 | |
---|
[feaf877] | 37 | try: |
---|
| 38 | import rtems_waf.rtems as rtems |
---|
| 39 | except: |
---|
[d6c6017] | 40 | print("error: no rtems_waf git submodule; see README.waf") |
---|
[feaf877] | 41 | import sys |
---|
| 42 | sys.exit(1) |
---|
| 43 | |
---|
[051ef30] | 44 | import libbsd_waf |
---|
| 45 | |
---|
[feaf877] | 46 | def init(ctx): |
---|
[32ceb14] | 47 | rtems.init(ctx, version = rtems_version, long_commands = True) |
---|
[051ef30] | 48 | libbsd_waf.init(ctx) |
---|
[feaf877] | 49 | |
---|
| 50 | def options(opt): |
---|
| 51 | rtems.options(opt) |
---|
[8b10210] | 52 | opt.add_option("--enable-auto-regen", |
---|
| 53 | action = "store_true", |
---|
| 54 | default = False, |
---|
| 55 | dest = "auto_regen", |
---|
| 56 | help = "Enable auto-regeneration of LEX, RPC and YACC files.") |
---|
| 57 | opt.add_option("--enable-warnings", |
---|
| 58 | action = "store_true", |
---|
| 59 | default = False, |
---|
| 60 | dest = "warnings", |
---|
| 61 | help = "Enable all warnings. The default is quiet builds.") |
---|
[56d787f] | 62 | opt.add_option("--net-test-config", |
---|
| 63 | default = "config.inc", |
---|
| 64 | dest = "net_config", |
---|
| 65 | help = "Network test configuration.") |
---|
[e1e10cd] | 66 | opt.add_option("--freebsd-options", |
---|
| 67 | action = "store", |
---|
| 68 | default = "", |
---|
| 69 | dest = "freebsd_options", |
---|
| 70 | help = "Set FreeBSD options (developer option).") |
---|
[d18c643] | 71 | opt.add_option("--optimization", |
---|
| 72 | action = "store", |
---|
| 73 | default = "2", |
---|
| 74 | dest = "optimization", |
---|
| 75 | help = "Set optimization level to OPTIMIZATION (-On compiler flag). Default is 2 (-O2).") |
---|
[051ef30] | 76 | libbsd_waf.options(opt) |
---|
[feaf877] | 77 | |
---|
[84288f4] | 78 | def bsp_configure(conf, arch_bsp): |
---|
| 79 | conf.check(header_name = "dlfcn.h", features = "c") |
---|
[1383c80] | 80 | conf.check(header_name = "rtems/pci.h", features = "c", mandatory = False) |
---|
[98d7c3c] | 81 | if not rtems.check_posix(conf): |
---|
| 82 | conf.fatal("RTEMS kernel POSIX support is disabled; configure RTEMS with --enable-posix") |
---|
| 83 | if rtems.check_networking(conf): |
---|
| 84 | conf.fatal("RTEMS kernel contains the old network support; configure RTEMS with --disable-networking") |
---|
[051ef30] | 85 | libbsd_waf.bsp_configure(conf, arch_bsp) |
---|
[84288f4] | 86 | |
---|
[feaf877] | 87 | def configure(conf): |
---|
[8b10210] | 88 | if conf.options.auto_regen: |
---|
| 89 | conf.find_program("lex", mandatory = True) |
---|
| 90 | conf.find_program("rpcgen", mandatory = True) |
---|
| 91 | conf.find_program("yacc", mandatory = True) |
---|
| 92 | conf.env.AUTO_REGEN = conf.options.auto_regen |
---|
| 93 | conf.env.WARNINGS = conf.options.warnings |
---|
[56d787f] | 94 | conf.env.NET_CONFIG = conf.options.net_config |
---|
[e1e10cd] | 95 | conf.env.FREEBSD_OPTIONS =conf.options.freebsd_options |
---|
[d18c643] | 96 | conf.env.OPTIMIZATION = conf.options.optimization |
---|
[84288f4] | 97 | rtems.configure(conf, bsp_configure) |
---|
[e1e10cd] | 98 | libbsd_waf.configure(conf) |
---|
[feaf877] | 99 | |
---|
| 100 | def build(bld): |
---|
| 101 | rtems.build(bld) |
---|
[051ef30] | 102 | libbsd_waf.build(bld) |
---|