Use of CC_COMPILE and CXX_COMPILE

Andrew Hughes gnu.andrew at redhat.com
Wed Jul 17 09:27:39 PDT 2013


----- Original Message -----
> 
> 
> 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++)."
> >
> > (make/{solaris,bsd,linux}/makefiles/rules.make)
> >
> > 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
> 

And saproc.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.

Yes, it seems the only place using them locally is the additions for this port,
which are misusing them in some cases.  The names of the flags are rather confusing;
CFLAGS includes both C and C++ flags, while CXXFLAGS is actually C preprocessor flags,
as far as I can tell (I would have thought this would be CPPFLAGS).

> 
> /Mikael
> 
> 
> >
> > Thanks,
> >
> 

-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: 248BDC07 (https://keys.indymedia.org/)
Fingerprint = EC5A 1F5E C0AD 1D15 8F1F  8F91 3B96 A578 248B DC07



More information about the hotspot-dev mailing list