Makefile, asm.py: Work on native arm64 by default

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2022-08-29 17:02:00 +09:00
parent 4c672c00b6
commit 29a85d6857
2 changed files with 11 additions and 3 deletions

View file

@ -1,4 +1,3 @@
ARCH ?= aarch64-linux-gnu-
RUSTARCH ?= aarch64-unknown-none-softfloat
ifeq ($(shell uname),Darwin)
@ -12,6 +11,12 @@ endif
$(info INFO: Toolchain path: $(TOOLCHAIN))
endif
ifeq ($(shell uname -m),aarch64)
ARCH ?=
else
ARCH ?= aarch64-linux-gnu-
endif
ifeq ($(USE_CLANG),1)
CC := $(TOOLCHAIN)clang --target=$(ARCH)
AS := $(TOOLCHAIN)clang --target=$(ARCH)

View file

@ -12,7 +12,10 @@ if uname.sysname == "Darwin":
TOOLCHAIN = "/usr/local/opt/llvm/bin/"
USE_CLANG = "1"
else:
DEFAULT_ARCH = "aarch64-linux-gnu-"
if uname.machine == "aarch64":
DEFAULT_ARCH = ""
else:
DEFAULT_ARCH = "aarch64-linux-gnu-"
USE_CLANG = "0"
TOOLCHAIN = ""
@ -98,7 +101,7 @@ class BaseAsm(object):
self._tmp = None
class ARMAsm(BaseAsm):
ARCH = os.path.join(os.environ.get("ARCH", "aarch64-linux-gnu-"))
ARCH = os.path.join(os.environ.get("ARCH", DEFAULT_ARCH))
CFLAGS = "-pipe -Wall -march=armv8.4-a"
LDFLAGS = "-maarch64elf"
HEADER = """