summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKinsey Moore <kinsey.moore@oarcorp.com>2023-03-27 10:26:20 -0500
committerJoel Sherrill <joel@rtems.org>2023-03-30 08:32:14 -0500
commit8689e18979015df7329da85f9ee820e439b09973 (patch)
tree49ad25e91162627c855155491f1a71c469117cdb
parentrtemslwip: Use common lwipopts for all BSPs (diff)
downloadrtems-lwip-8689e18979015df7329da85f9ee820e439b09973.tar.bz2
wscript: Build a header instead of using -D
This change moves the use of items configured in config.ini from using -D to set defines on the command line to using a header built by waf. This also resolves an issue where configuration parameters were bleeding between BSPs when multiple BSPs were configured.
-rw-r--r--rtemslwip/include/lwipopts.h2
-rw-r--r--wscript19
2 files changed, 18 insertions, 3 deletions
diff --git a/rtemslwip/include/lwipopts.h b/rtemslwip/include/lwipopts.h
index 157cce8..27e2c91 100644
--- a/rtemslwip/include/lwipopts.h
+++ b/rtemslwip/include/lwipopts.h
@@ -27,6 +27,8 @@
#ifndef __LWIPOPTS_H__
#define __LWIPOPTS_H__
+#include <lwipconfig.h>
+
/* Critical items that all BSPs must use for full functionality */
#define SYS_LIGHTWEIGHT_PROT 1
#define NO_SYS 0
diff --git a/wscript b/wscript
index f1b919e..59bf81d 100644
--- a/wscript
+++ b/wscript
@@ -91,15 +91,23 @@ def get_configured_bsp_options(cp, arch, bsp):
return options
+bsp_opts_target = os.path.join("rtemslwip", "include", "lwipconfig.h")
+
+
def bsp_configure(conf, arch_bsp):
cp = get_config()
arch = rtems.arch(arch_bsp)
bsp = rtems.bsp(arch_bsp)
config_options = get_configured_bsp_options(cp, arch, bsp)
for key, val in config_options.items():
- flag = "-D"+key+"="+val
- conf.env.CFLAGS.append(flag)
- conf.env.CXXFLAGS.append(flag)
+ conf.define(key, val, quote=False)
+ conf.env.include_key = []
+ conf.write_config_header(
+ os.path.join(arch_bsp, bsp_opts_target),
+ guard="CONFIGURED_LWIP_BSP_OPTS_H",
+ top=True
+ )
+ conf.env.include_key = None
lwip.bsp_configure(conf, arch_bsp)
@@ -112,4 +120,9 @@ def configure(conf):
def build(bld):
rtems.build(bld)
+ arch_bsp = bld.env.RTEMS_ARCH_BSP
+ arch = rtems._arch_from_arch_bsp(arch_bsp)
+ bsp = rtems.bsp(arch_bsp)
+ install_target = os.path.join(bld.env.PREFIX, arch, bsp, "lib", "include")
+ bld.install_files(install_target, bsp_opts_target)
lwip.build(bld)