Ability to override compiler from environment

David Herron David.Herron at Sun.COM
Mon Jun 23 22:17:08 UTC 2008


I was thinking about this issue of compiling with different gcc's and it 
seems the normal way to install multiple gcc's is to use suffixes for 
the version like so:-

gcc-4.1 == gcc v4.1.x
gcc-3.4 == gcc v3.4.x
gcc       == gcc v4.2.x

I groped around the OpenJDK makefiles and found

jdk/make/common/shared/Compiler-gcc.gmk
corba/make/common/shared/Compiler-gcc.gmk
hotspot/build/linux/makefiles/gcc.make

both contain lines which say

CC=gcc
CPP=g++

According to the GNU make manual .. 
http://www.gnu.org/software/make/manual/html_node/Setting.html#Setting 
.. these values could be overridden with a small change in the makefile

CC?=gcc
CPP?=g++

And then setting CC or CPP in the environment would make it so the 
variable is already set and these lines in the makefile would have no 
effect.



- David Herron





More information about the build-dev mailing list