From 193ae1aeacd940ec3b48cc52f135f0695648a5f4 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Sun, 21 Mar 2021 13:05:11 -0400 Subject: [PATCH] Fix ARCH setting on the cross-compilation cases. This makes it possible to pass ARCH in correctly when cross compiling. Signed-off-by: Peter Jones --- Make.defaults | 23 ++++++++++------------- Makefile | 1 - 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Make.defaults b/Make.defaults index 280005e..362bd1f 100755 --- a/Make.defaults +++ b/Make.defaults @@ -65,13 +65,15 @@ LIBDIR := $(PREFIX)/lib INSTALL := install # Compilation tools -HOSTCC := $(prefix)gcc -CC := $(prefix)$(CROSS_COMPILE)gcc -AS := $(prefix)$(CROSS_COMPILE)as -LD := $(prefix)$(CROSS_COMPILE)ld -AR := $(prefix)$(CROSS_COMPILE)ar -RANLIB := $(prefix)$(CROSS_COMPILE)ranlib -OBJCOPY := $(prefix)$(CROSS_COMPILE)objcopy +COMPILER ?= gcc +ARCHIVER ?= gcc-ar +HOSTCC := $(COMPILER) +CC := $(CROSS_COMPILE)$(COMPILER) +AS := $(CROSS_COMPILE)as +LD := $(CROSS_COMPILE)ld +AR := $(CROSS_COMPILE)$(ARCHIVER) +RANLIB := $(CROSS_COMPILE)ranlib +OBJCOPY := $(CROSS_COMPILE)objcopy ifneq ($(CCACHE_DISABLE),) export CCACHE_DISABLE @@ -80,12 +82,7 @@ endif # Host/target identification OS := $(shell uname -s) HOSTARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed -e s,i[3456789]86,ia32, -e 's,armv[67].*,arm,' ) -ARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed -e s,i[3456789]86,ia32, -e 's,armv[67].*,arm,' ) - -# Get ARCH from the compiler if cross compiling -ifneq ($(CROSS_COMPILE),) - override ARCH := $(shell $(CC) -dumpmachine | cut -f1 -d-| sed -e s,i[3456789]86,ia32, -e 's,armv[67].*,arm,' ) -endif +ARCH ?= $(shell $(CC) $(ARCH3264) -dumpmachine | cut -f1 -d- | sed -e s,i[3456789]86,ia32, -e 's,armv[67].*,arm,' ) # FreeBSD (and possibly others) reports amd64 instead of x86_64 ifeq ($(ARCH),amd64) diff --git a/Makefile b/Makefile index c1f48d3..3c6f62b 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,6 @@ mkvars: @echo LIBDIR=$(LIBDIR) @echo OBJCOPY=$(OBJCOPY) @echo OS=$(OS) - @echo prefix=$(prefix) @echo PREFIX=$(PREFIX) @echo RANLIB=$(RANLIB) @echo SRCDIR=$(SRCDIR)