From 79540b1d336b229ed98af9f049e6a520768f384c Mon Sep 17 00:00:00 2001 From: Cryolitia PukNgae Date: Thu, 17 Oct 2024 12:53:12 +0800 Subject: [PATCH] feat(mfd_aes_brute): detect march and mcpu fix build on riscv64 --- tools/mfd_aes_brute/Makefile | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/mfd_aes_brute/Makefile b/tools/mfd_aes_brute/Makefile index d0df682f6..8080b67b5 100644 --- a/tools/mfd_aes_brute/Makefile +++ b/tools/mfd_aes_brute/Makefile @@ -5,15 +5,15 @@ MYCFLAGS = -Ofast MYDEFS = MYLDLIBS = -lcrypto -# A better way would be to just try compiling with march and seeing if we succeed -cpu_arch = $(shell uname -m) -ifneq ($(findstring arm64, $(cpu_arch)), ) - MYCFLAGS += -mcpu=native -# iOS 'fun' -else ifneq ($(findstring iP, $(cpu_arch)), ) - MYCFLAGS += -mcpu=native -else +SUPPORT_MARCH := $(shell $(CC) -xc /dev/null -c -o /dev/null -march=native > /dev/null 2>/dev/null && echo y) +SUPPORT_MCPU := $(shell $(CC) -xc /dev/null -c -o /dev/null -mcpu=native > /dev/null 2>/dev/null && echo y) + +ifeq ($(DONT_BUILD_NATIVE),y) + # do nothing +else ifeq ($(SUPPORT_MARCH),y) MYCFLAGS += -march=native +else ifeq ($(SUPPORT_MCPU),y) + MYCFLAGS += -mcpu=native endif ifneq ($(SKIPPTHREAD),1) @@ -43,6 +43,8 @@ ifeq ($(USE_MACPORTS),1) MYLDFLAGS += -L$(MACPORTS_PREFIX)/lib/openssl-3 -L$(MACPORTS_PREFIX)/lib/openssl-1.1 endif +showinfo: $(info c flags: $(MYCFLAGS)) + brute_key : $(OBJDIR)/brute_key.o $(MYOBJS) mfd_aes_brute : $(OBJDIR)/mfd_aes_brute.o $(MYOBJS)