Makefile macro definition: Extra_cflags + =-D with Config_ =y

Source: Internet
Author: User

Extra_cflags + =-D with Config_ =y

1.

If you define a macro config_debug

Defined in. C as: #define Config_debug

Defined in Makefile as: config_debug=y

If we want to enter a macro definition for a. c file in makefile, use Extra_cflags + = Dconfig_debug(equivalent to defining #define in. c Files config_ DEBUG)

At this point config_debug=y and extra_cflags + = Dconfig_debug The difference should you have seen, the former is used for makefile compile, for example obj-(config_ DEBUG) + = TEST.O, while the latter is used in the. C source file, for example:

#if defined (config_debug)

...

#else

...

#endif

2.

If you define a macro Config_debug = 3

Defined in. C as: #define CONFIG_DEBUG 3

If we want to enter a macro definition for the. c file in makefile, use extra_cflags + =-dconfig_debug=3

At this point the definitions are exactly the same.



Makefile macro definition: Extra_cflags + =-D with Config_ =y

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.