[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: setting default compiler version



On 5/12/05, Martin Henne <martin.henne@web.de> wrote:
> Robert Vangel wrote:
> > When using Makefile's, look at the CC & GCC environmental variables (I'm
> > not actually sure if G++ is included there... sorry...)
> What is the environment variable to set the preprocessor to cpp-3.4
> instead of cpp?

Often, a Makefile will use the $(CC) variable as its C compiler and
$(CXX) as its C++ compiler, and I believe gmake uses these in its
implicit rules.  The compiler itself should determine which version of
cpp to use.  If you only want to run the preprocessor, use "$(CC) -E"
and redirect the output to a file.

To try a specific compiler once (with a clean source code directory),
the following should work:
make CC=gcc-3.4 CXX=g++-3.4

If you're using autoconf, then in Makefile.in you could have the lines:
CC := @CC@
CXX := @CXX@
and when running configure:
./configure CC=gcc-3.4 CXX=g++-3.4
When Makefile is generated from Makefile.in, you'll then end up with:
CC := gcc-3.4
CXX := g++-3.4
All subsequent makes will use these compilers.

-- 
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh
http://mamarsh.blogspot.com



Reply to: