[Skiboot] [PATCH] external/common: Adjust rules.mk to correctly use CROSS_COMPILE

Patrick Williams patrick at stwcx.xyz
Wed Aug 3 05:10:23 AEST 2016


On Tue, Aug 02, 2016 at 03:14:34PM +1000, Cyril Bur wrote:
> diff --git a/external/common/rules.mk b/external/common/rules.mk
> index bb12fd5..59e8905 100644
> --- a/external/common/rules.mk
> +++ b/external/common/rules.mk
> @@ -1,5 +1,8 @@
> -CC ?= $(CROSS_COMPILE)gcc
> -LD ?= $(CROSS_COMPILE)ld
> +ifdef CROSS_COMPILE
> +CC = $(CROSS_COMPILE)gcc
> +LD = $(CROSS_COMPILE)ld
> +endif
> +
>  ARCH := $(shell $(GET_ARCH) "$(CROSS_COMPILE)")

I don't see myself as a make expert, nor do I know what the best
practices are in this regard.  Ultimately, you guys need to decide what
is best for these makefiles but, with my current understanding, unless
there is a corresponding change in both op-build and openbmc, this change
will not work.

I've already spent a lot of time in the last month on getting libflash 
/ pflash makefiles set so we can do cross-compiling on ARM.  I know Joel,
Brad and Stewart have also put in time in this area.  If this change
goes in, I would prefer that someone volunteer to also do the
corresponding updates to the op-build and openbmc distros.

Now for my observations...

There is currently a CROSS and a CROSS_COMPILE variable in skiboot.
What is each for?

The ARCH variable is only set if CROSS_COMPILE is set with a proper
prefix and the ARCH is critical for compiling libflash correctly.  Thus,
with this change it will not be possible to set both a custom CC and
allow the makefiles to continue to derive the ARCH from the prefix.  As
I have previously stated, having CC overwritten by CROSS_COMPILE breaks
a non-simple CC and ties you to gcc (precluding clang).  We don't expect
distros to determine ARCH themselves, do we?

Even the op-build recipe for libflash sets both CC and CROSS_COMPILE, so
this isn't just a Yocto "problem".
https://github.com/open-power/op-build/blob/master/openpower/package/libflash/libflash.mk#L20

-- 
Patrick Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.ozlabs.org/pipermail/skiboot/attachments/20160802/5ceb7120/attachment-0001.sig>


More information about the Skiboot mailing list