test: Use -dumpmachine to find architecture instead of expecting -target

This commit is contained in:
mintsuki 2023-09-11 17:02:57 -05:00
parent 4b08bede0e
commit 4470aa0cfa

View File

@ -12,15 +12,15 @@ override LD := $(LD_FOR_TARGET)
override QEMU := qemu-system-x86_64 override QEMU := qemu-system-x86_64
QEMUFLAGS = -m 1G -enable-kvm -cpu host QEMUFLAGS = -m 1G -enable-kvm -cpu host
ifneq ($(findstring x86_64,$(CC_FOR_TARGET)),) ifneq ($(findstring x86_64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
override LDFLAGS += \ override LDFLAGS += \
-m elf_x86_64 -m elf_x86_64
endif endif
ifneq ($(findstring aarch64,$(CC_FOR_TARGET)),) ifneq ($(findstring aarch64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
override LDFLAGS += \ override LDFLAGS += \
-m aarch64elf -m aarch64elf
endif endif
ifneq ($(findstring riscv64,$(CC_FOR_TARGET)),) ifneq ($(findstring riscv64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
override LDFLAGS += \ override LDFLAGS += \
-m elf64lriscv -m elf64lriscv
endif endif
@ -60,7 +60,7 @@ override CFLAGS += \
-I. \ -I. \
-D_LIMINE_PROTO -D_LIMINE_PROTO
ifneq ($(findstring x86_64,$(CC_FOR_TARGET)),) ifneq ($(findstring x86_64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
override CFLAGS += \ override CFLAGS += \
-m64 \ -m64 \
-march=x86-64 \ -march=x86-64 \
@ -68,12 +68,12 @@ override CFLAGS += \
-mno-red-zone -mno-red-zone
endif endif
ifneq ($(findstring aarch64,$(CC_FOR_TARGET)),) ifneq ($(findstring aarch64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
override CFLAGS += \ override CFLAGS += \
-mgeneral-regs-only -mgeneral-regs-only
endif endif
ifneq ($(findstring riscv64,$(CC_FOR_TARGET)),) ifneq ($(findstring riscv64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
override CFLAGS += \ override CFLAGS += \
-march=rv64imac \ -march=rv64imac \
-mabi=lp64 \ -mabi=lp64 \
@ -98,7 +98,7 @@ override CFLAGS_MB := \
-I. \ -I. \
-I../common/protos -I../common/protos
ifneq ($(findstring 86,$(CC_FOR_TARGET)),) ifneq ($(findstring 86,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
all: test.elf multiboot2.elf multiboot.elf all: test.elf multiboot2.elf multiboot.elf
else else
all: test.elf all: test.elf