开发者

Can we add a specific CFLAG to a eCos package when an cdl_option was enabled?

开发者 https://www.devze.com 2023-01-24 22:05 出处:网络
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_o

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 开发者_JS百科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!


-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 the install/include/pkgconf/ directory after running ecosconfig. You can add further define 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 a legal_values or a calculated 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号