Question regarding #define

Norman Feske norman.feske at ...1...
Mon Feb 12 19:30:38 CET 2018


Hi Stefan,

On 12.02.2018 19:20, Stefan wrote:
> How can one set a special preprocessor #define for a .cc file without touching the code? 
> 
> Is there a possibility to set the #define in the .mk-file?

you can use the -D command-line argument for the compiler, which you can
pass via the 'CC_OPT' variable, e.g.:

  CC_OPT += -DHAVE_NICE_FEATURE=1

This passes the argument for all compilation units of the target.mk
file. If you want to apply it to a single compilation unit only, you may
specify the file name (without extension) as follows:

  CC_OPT_single_file += -Dprivate=public

Here, the dangerous define is only used when compiling 'single_file.cc'.

To take a close look at the compiler arguments, you may add VERBOSE=
when invoking make.

Cheers
Norman

-- 
Dr.-Ing. Norman Feske
Genode Labs

https://www.genode-labs.com · https://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth




More information about the users mailing list