LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   excluding some lines from compiling (https://www.linuxquestions.org/questions/programming-9/excluding-some-lines-from-compiling-591509/)

enzom83 10-13-2007 11:03 AM

excluding some lines from compiling
 
Dear all,
I have created some C++ classes for a plugin of a simulator.
Some lines of these classes are useful for making up a log file, in order to testing the good working of the plugin.

When I use this plugin, I would disable the making up of the log file.
I thought to use the following macro:
Code:

#ifdef DEBUG
    // code for making up the log file
#endif

In this way, if I compile the classes in release mode, the code within
Code:

#ifdef DEBUG
and
Code:

#endif
statements is not compiled.

In order to compiling the plugin, I use a Makefile.gen, and I generate the Makefile by the command
Code:

make -f Makefile.gen
.

Within the Makefile I found the following line:
Code:

CFLAGS=-O2 -DNDEBUG=1 -DWITH_PARSIM -DWITH_NETBUILDER
Does it exist an option for make command in order to create the following line in the Makefile?
Code:

CFLAGS=-O2 -DDEBUG -DWITH_PARSIM -DWITH_NETBUILDER
Thanks a lot!

matthewg42 10-13-2007 12:12 PM

From the gcc man page:
Code:

-D name=definition
          The contents of definition are tokenized and processed as if they appeared during
          translation phase three in a #define directive.  In particular, the definition will be
          truncated by embedded newline characters.

          If you are invoking the preprocessor from a shell or shell-like program you may need
          to use the shell’s quoting syntax to protect characters such as spaces that have a
          meaning in the shell syntax.

          If you wish to define a function-like macro on the command line, write its argument
          list with surrounding parentheses before the equals sign (if any).  Parentheses are
          meaningful to most shells, so you will need to quote the option.  With sh and csh,
          -D’name(args...)=definition’ works.

          -D and -U options are processed in the order they are given on the command line.  All
          -imacros file and -include file options are processed after all -D and -U options.


enzom83 10-13-2007 12:42 PM

Sorry...:confused:
I don't understand...


All times are GMT -5. The time now is 04:38 AM.