Overriding compiler options specified in makefiles

QNX SDP8.0Programmer's GuideDeveloper

You can specify compiler options in the shell environment where you run the make utility, to override the options specified in standard makefiles.

Makefiles append compiler options (flags) to the CCFLAGS and CXXFLAGS variables (macros). If you set the CCOPTS and CXXOPTS variables in the shell where you run make, the contents of these variables are added to the compiler command after the contents of CCFLAGS and CXXFLAGS. This means that any compiler options specified in CCOPTS and CXXOPTS override any of the same options specified in makefiles through CCFLAGS and CXXFLAGS.

In summary, use the CCOPTS variable for C compiler options rather than the CCFLAGS variable, and the CXXOPTS variable for C++ compiler options rather than the CXXFLAGS variable.

Similarly, the CPPOPTS variable can be used to override the C/C++ preprocessor options specified in makefiles through the CPPFLAGS variable.

Page updated: