Make GNU make use a different compiler

How can I make GNU Make use a different compiler without manually editing the makefile?


You should be able to do something like this:

make CC=my_compiler

This is assuming whoever wrote the Makefile used the variable CC.


You can set the environment variables CC and CXX, which are used for compiling C and C++ files respectively. By default they use the values cc and g++