Reputation: 3233
Okay I am assuming that the -D
prefix means #define
whatever variable name is followed by it, however I cannot find any documentation on this makefile feature for compiler flags.
CXX=clang -DTHISISPREPROCESSORVARIABLE
So -DTHISISPREPROCESSORVARIABLE
in the make process would define the preprocessor variable THISISPREPROCESSORVARIABLE
and would make the follow cout
compiled.
#ifdef THISISPREPROCESSORVARIABLE
std::cout << "this should exist with the -D" << endl;
#endif
Is this the right assumption? It seems to work, just can anyone confirm this -D
is referring to #define
(anyone have any links to some makefile docs that can fill in all these commands definitions?)
Upvotes: 4
Views: 7119
Reputation: 66922
GCC, MSVC, and Intel, all have this flag documented, and Clang just uses GCC flags by default. I just found it on Clang's help page waaaay at the bottom (for clang-cl for windows), and harmic found it more clearly here for linux.
Execute
clang-cl /?
to see a list of supported options:
/D <macro[=value]>
Define macro
harmic observes that these are compiler flags, and have nothing at all to do with makefiles, which is why you can't find it in the makefile docs. These flags can be put inside a makefile which will pass them to the compiler, but are not part of makefiles.
Upvotes: 4