当启用 cdl_option 时,我们可以将特定的 CFLAG 添加到 eCos 包吗?
假设我们有一个名为 CYGPKG_FOO 的包,其中有一个 cdl_option“CYGPKG_FOO_FEATURE_A_ENABLE”。我希望在启用此 cdl_option 时将特定的 gcc 标志(例如“-DFEATURE_A=1”)添加到此包的 CFLAGS 中。
但《eCos 组件编写者指南》说:
http ://ecos.sourceware.org/docs-3.0/cdl-guide/build.make.html#BUILD.FLAGS
从上面的链接来看,我们似乎无法根据 cdl_option 选择添加/删除 CFLAGS ...
所以我的问题是:我可以做第一段中描述的事情吗?如果可以,怎么做?
谢谢!
Say we have a package named CYGPKG_FOO, which has a cdl_option "CYGPKG_FOO_FEATURE_A_ENABLE". I want a specific gcc flags (e.g. "-DFEATURE_A=1") added to the CFLAGS of this package when this cdl_option was enabled.
But "The eCos Component Writer's Guide" said:
http://ecos.sourceware.org/docs-3.0/cdl-guide/build.make.html#BUILD.FLAGS
From the link above, it looks like we can't add/remove CFLAGS based on cdl_option selections...
So my question here is: can I do what was described in first paragraph, and if yes, how?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
-DFEATURE_A=1
与在源文件或头文件中写入#define FEATURE_A 1
相同。当设置 CYGPKG_FOO_FEATURE_A_ENABLE 时,会导致在自动生成的包含文件中设置一些预处理器符号。运行
ecosconfig
后查看install/include/pkgconf/
目录。如果您不喜欢默认值,您可以向 CDL 添加更多define
行,以定义更多符号。如果您想精确控制这些符号采用的值,您可以使用进一步的
cdl_option
来实现,也许可以使用legal_values
或计算的
代码>指令;如果没有,您可以在包内的头文件中添加合适的定义,以切换预处理器符号的存在或不存在。-DFEATURE_A=1
is just the same as writing#define FEATURE_A 1
in a source or header file.When
CYGPKG_FOO_FEATURE_A_ENABLE
is set, by this causes some preprocessor symbols to be set in the autogenerated include files. Check out theinstall/include/pkgconf/
directory after runningecosconfig
. You can add furtherdefine
lines to your CDL to cause further symbols to be defined, if the defaults are not to your liking.If you want to precisely control what values those symbols take, you may be able to do so with a further
cdl_option
, perhaps with alegal_values
or acalculated
directive; if not, you can add suitable defines in a header file inside your package which switch on the presence or absence of a preprocessor symbol.