help-make
[Top][All Lists]
Advanced

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

Re: ${CC} versus ${CROSS_CC}: best practices question


From: Paul D. Smith
Subject: Re: ${CC} versus ${CROSS_CC}: best practices question
Date: Fri, 13 May 2005 10:15:37 -0400

%% "Robert P. J. Day" <address@hidden> writes:

  rpjd> i inherited someone else's make-based project, which supports
  rpjd> multi-arch builds by, based on your selection, redefining a
  rpjd> number of basic variables with assignments like:

  rpjd>   CC=${CROSS_COMPILE}gcc
  rpjd>   LD=${CROSS_COMPILE}ld

  rpjd> and so on, and defines all of the rules based on ${CC}, ${LD}, etc.

  rpjd> the drawback i see to this is that it assumes that *every*
  rpjd> compile in the entire process using ${CC} will use the
  rpjd> cross-compiler version of the development commands, and it's
  rpjd> possible that part of the build could quite possibly involve the
  rpjd> occaional native compile, for whatever reason.

  rpjd>   CROSS_CC=${CROSS_COMPILE}gcc
  rpjd>   CROSS_LD=${CROSS_COMPILE}ld

I always do it the other way around.  As you say, needing to build a
native tool is not common.  So, I do something like:

    HOST_CC = gcc
    HOST_CXX = g++

    CC = $(CROSS_COMPILE)gcc
    CXX = $(CROSS_COMPILE)g++

etc.  This way the "default" is the common case, which is cross-compile.
Also, often you need to write special rules for the native builds
anyway, since you typically don't want the output to live in the same
object directories as the cross-compiled code.


YMMV.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]