:: commit f8bfe41e71b12730ae8fdb0ca2f62338b9f18af3

mintsuki <mintsuki@protonmail.com> — 2023-09-11 22:02

parents: 0f7ee05635

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

diff --git a/test/GNUmakefile b/test/GNUmakefile
index 66b8e8e7..7d405797 100644
--- a/test/GNUmakefile
+++ b/test/GNUmakefile
@@ -12,15 +12,15 @@ override LD := $(LD_FOR_TARGET)
 override QEMU := qemu-system-x86_64
 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 += \
     -m elf_x86_64
 endif
-ifneq ($(findstring aarch64,$(CC_FOR_TARGET)),)
+ifneq ($(findstring aarch64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
 override LDFLAGS += \
     -m aarch64elf
 endif
-ifneq ($(findstring riscv64,$(CC_FOR_TARGET)),)
+ifneq ($(findstring riscv64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
 override LDFLAGS += \
     -m elf64lriscv
 endif
@@ -60,7 +60,7 @@ override CFLAGS += \
     -I. \
     -D_LIMINE_PROTO
 
-ifneq ($(findstring x86_64,$(CC_FOR_TARGET)),)
+ifneq ($(findstring x86_64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
 override CFLAGS += \
     -m64 \
     -march=x86-64 \
@@ -68,12 +68,12 @@ override CFLAGS += \
     -mno-red-zone
 endif
 
-ifneq ($(findstring aarch64,$(CC_FOR_TARGET)),)
+ifneq ($(findstring aarch64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
 override CFLAGS += \
     -mgeneral-regs-only
 endif
 
-ifneq ($(findstring riscv64,$(CC_FOR_TARGET)),)
+ifneq ($(findstring riscv64,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
 override CFLAGS += \
     -march=rv64imac \
     -mabi=lp64 \
@@ -98,7 +98,7 @@ override CFLAGS_MB := \
     -I. \
     -I../common/protos
 
-ifneq ($(findstring 86,$(CC_FOR_TARGET)),)
+ifneq ($(findstring 86,$(shell $(CC_FOR_TARGET) -dumpmachine)),)
 all: test.elf multiboot2.elf multiboot.elf
 else
 all: test.elf
tab: 248 wrap: offon