About g++ option -MM

Peng Yu pengyu.ut@gmail.com
Thu Jan 26 02:10:00 GMT 2006


Suppose I have a file "main.cc", if I run the following command "g++
-MM main.cc, I end up with following rule "main.o: main.cc main.h".

What if I want something like the following contents? Basically, what
I want are two sets of objects code. One is with compiler option "-g",
the other is with option "-O3".

Is it possible to do it in g++, or I have to do some scripting like using perl.
####################
main-g.o: main.cc main.h
  $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -g -c -o $@ $<

main-o.o: main.cc main.h
  $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -O3 -c -o $@ $<
####################

Thanks,
Peng



More information about the Gcc-help mailing list