I am looking at a CFLAGS of –
CFLAGS=-g -w -D LINUX -O3 -fpermissive
in a Makefile. What does the -D flag do? I see on the man page that
-D name
Predefine name as a macro, with definition 1.
but I don’t know how to interpret that. My interpretation is…its making LINUX a macro and only doing -03 and -fpermissive when in a linux environment. Is that right? If not, then what? Thanks for any help
It is equivalent to adding the statement
#define LINUX 1in the source code of the file that is being compiled. It does not have any effect on other compilation flags. The reason for this is it’s an easy way to enable#ifdefstatements in the code. So you can have code that says:It will only be enabled if that macro is enabled which you can control with the
-Dflag. So it is an easy way to enable/disable conditional compilation statements at compile time without editing the source file.