Please resend as a text-only - patchwork doesn't capture HTML patches. Also please remove the "Micron Confidential" notations. Thanks, Avri From: Zhan Liu <zliua@xxxxxxxxxx> Sent: Friday, April 12, 2024 6:12 PM To: 'linux-mmc@xxxxxxxxxxxxxxx' <linux-mmc@xxxxxxxxxxxxxxx> Cc: Avri Altman <Avri.Altman@xxxxxxx>; 'Ulf Hansson' <ulf.hansson@xxxxxxxxxx> Subject: [PATCH v1] mmc-utils:makefile: cross compile CAUTION: This email originated from outside of Western Digital. Do not click on links or open attachments unless you recognize the sender and know that the content is safe. Micron Confidential [PATCH v1] mmc-utils: makefile: cross compile From: Zhan Liu mailto:zliua@xxxxxxxxxx Problem and my changes Current makefile can only compile for local gcc (x86). Add cross compile so we can easily compile for other platform by doing "make ARCH=arm CROSS_GCC=/path/to/your/cross/compiler" . --- Signed-off-by: Zhan Liu mailto:zliua@xxxxxxxxxx ; --- diff --git a/Makefile b/Makefile index a890833..fb7e30e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,19 @@ -CC ?= gcc +ifneq ($(CROSS_GCC), ) +ifneq ($(ARCH), ) +GCC_DIR = $(dir $(CROSS_GCC)) +# To remove the trailing 'bin/' part +GCC_DIR := $(patsubst %bin/,%, $(GCC_DIR)) +endif +endif + +ifeq ($(ARCH), arm) +CC = $(CROSS_GCC)gcc +else #By default, we will build for X86 platform +CC = gcc +endif + + + GIT_VERSION := "$(shell git describe --abbrev=6 --always --tags)" AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 \ -DVERSION=\"$(GIT_VERSION)\" Micron Confidential