Skip to content

Commit

Permalink
test: Use -dumpmachine to find architecture instead of expecting -target
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsuki committed Sep 11, 2023
1 parent 4b08bed commit 4470aa0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -60,20 +60,20 @@ 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 \
-mgeneral-regs-only \
-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 \
Expand All @@ -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
Expand Down

0 comments on commit 4470aa0

Please sign in to comment.