[CRIU] [PATCH] Makefile: add CROSS_COMPILE directive

Cyrill Gorcunov gorcunov at openvz.org
Thu May 30 05:18:02 EDT 2013


On Thu, May 30, 2013 at 05:56:12PM +0900, Chanho Park wrote:
> This patch adds CROSS_COMPILE directive. We can use it like below:
> 
> $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
> 
> Signed-off-by: Chanho Park <chanho61.park at samsung.com>
> Signed-off-by: Myungjoo Ham <myungjoo.ham at samsung.com>
> ---
>  Makefile |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 485537a..3a46a58 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -26,12 +26,12 @@ include Makefile.config
>  FIND		:= find
>  CSCOPE		:= cscope
>  RM		:= rm -f
> -LD		:= ld
> -CC		?= gcc
> +LD		:= $(CROSS_COMPILE)ld
> +CC		:= $(CROSS_COMPILE)gcc
>  NM		:= nm
>  SH		:= bash
>  MAKE		:= make
> -OBJCOPY		:= objcopy
> +OBJCOPY		:= $(CROSS_COMPILE)objcopy

Maybe it is worth to do it in the way we assign gcc?
Ie,

LD		?= ld
OBJCOPY		?= objcopy

Then you should be able to call for

make ARCH=arm CC=arm-linux-gnueabi-cc LD=arm-linux-gnueabi-ld OBJCOPY=arm-linux-gnueabi-objcopy

or even more

ifeq ($(ARCH),arm)
	CC		?= arm-linux-gnueabi-cc
	LD		?= arm-linux-gnueabi-ld
	OBJCOPY		?= arm-linux-gnueabi-objcopy
endif

That said I'm personally fine with the patch as it is but could you please
check how linux kernel build farm handles cross-compiling (since we're trying
to keep our approach somehow near them).


More information about the CRIU mailing list