I'm building a package which provides many makefiles, each makefile has hard coded in side something like
CFLAGS = -g -O2 -Wall ...
CXXFLAGS = -g -O2 -Wall ...
I want to discard -g
option but I don't want to edit all makefiles (even not automatically with sed
or something similar). The configure
script which comes with the package doesn't have enable/disable debug option but I can pass it CFLAGS
and CXXFLAGS
variables and it concatenates their values to the CFLAGS
and CXXFLAGS
variables respectively which include the -g
option.
Is there an option which will discard -g
in case it is specified? Something like
gcc -option-im-looking-for -g file.c -o file
Will build the binary file
without debug symbols. I don't want to strip the binary, I want it to be created stripped.
You could negate the effect of -g
by adding -g0
. Saying
gcc -g -g0 foo.c -o file.o
would produce a binary identical to one obtained by saying
gcc foo.c -o foo.o
Quoting man gcc
:
-glevel
...
Level 0 produces no debug information at all. Thus, -g0 negates
-g.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With