Use of CC_COMPILE and CXX_COMPILE
mikael.gerdin at oracle.com
Wed Jul 17 07:33:43 PDT 2013
On 2013-07-17 16:20, Andrew Hughes wrote:
> In the Solaris, *BSD and GNU/Linux makefiles, it states:
> "# $(CC) is the c compiler (cc/gcc), $(CXX) is the c++ compiler (CC/g++)."
> However, both CC_COMPILE and CXX_COMPILE are then defined in the same way.
> CC_COMPILE = $(CC) $(CXXFLAGS) $(CFLAGS)
> CXX_COMPILE = $(CXX) $(CXXFLAGS) $(CFLAGS)
> Shouldn't CXXFLAGS only be added to CXX_COMPILE and not CC_COMPILE?
> It also appears that C++ flags are being added to $(CFLAGS):
> make/solaris/makefiles/gcc.make:CFLAGS += -fcheck-new
> make/bsd/makefiles/gcc.make:CFLAGS += -fcheck-new
> make/linux/makefiles/gcc.make:CFLAGS += -fcheck-new
> We hit this when trying to build some C code (mkbc.c for our ARM32 port)
> using $(CC_COMPILE). Has $(CC_COMPILE) ever been used with C code?
> Is there any in HotSpot itself?
There is jsig.c, see make/<platform>/makefiles/jsig.make
It seems like jsig.make avoids using $(CC_COMPILE) and selects its own
set of compiler flags, possibly because it's compiled and linked into
its own .so all at once.
I can't find any references to CC_COMPILE or its derived COMPILE.CC,
GENASM.CC and PREPROCESS.CC in the sources so changing it seems safe enough.
More information about the hotspot-dev