I want to backtrace the makefile for firefox so that I can get the final gcc command that is used to compile the c++ files. How can I do that?
Can you redirect the output of make
to a file, then use a text editor to search for the line of interest?
The usual stunt for this is to replace gcc with a program that reads the gcc command line, store it in some log file so it can be inspected, and then launches gcc with the command line. You can do this by replacing "gcc.exe" in your development directories by this stepping stone program.
If you find a line in there that begins with "@ $(CXX)" or "@ g++", then change the line to "$(CXX)" or "g++" -- in other words, delete the "@" symbol from the line. When an "@" symbol appears at the beginning of a command in a Makefile, it causes Make to not echo the command before executing it. Deleting the "@" symbol will cause the expanded form of the line to be echoed before the command is invoked.
I haven't looked at Firefox's makefile, so it is more than possible that they are using predefined pattern rules for building the code, in which case you won't see any lines beginning with "$(CXX)" . If that is the case, you will need to override the rules, so that the default build rules echo the commands before executing them.
For more information on overriding Makefile pattern build rules, see this link:
http://www.gnu.org/software/make/manual/make.html#Pattern-Rules
Here's the make rule that compiles C++ files: http://hg.mozilla.org/mozilla-central/annotate/c1ab8650e0ce/config/rules.mk#l1391
If all you want to do is replace the compiler, you can (in your mozconfig, or on the configure commandline) set CXX="whatever".