Producing .o and .s files at once

Tom Womack tom@womack.net
Sun Feb 27 06:43:00 GMT 2000


One of the few nice features of the Visual C++ command-line compiler is
that, with a command line of the form

cl /c /Fa foo.cpp

you can get it to output an assembler listing of the program at the same
time as compiling it.

>From the gcc documentation, it appears that I have to do

g++ -c -S foo.cpp
g++ -c foo.cpp

to do the same thing - which makes my Makefile rather repetitive, and has
often annoyed me in optimisation when I change the code, rebuild with
gcc -S, and the executable I'm running no longer corresponds to the
assembler I have.

Is there an option which produces the .o and .s files from the same compile?

Tom



More information about the Gcc mailing list