Is it possible to define a C macro in a makefile?

前端 未结 3 1498
情话喂你
情话喂你 2020-12-09 15:57

Is it possible to put the equivalent of #define VAR (in a C program) into a makefile, so that one can control which part of the program should be compiled?

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-09 16:43

    Accordingly to cc manpage on linux

    -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.
    

提交回复
热议问题