Skip to content

Commit

Permalink
feat: detect march and mcpu
Browse files Browse the repository at this point in the history
fix build on riscv64
  • Loading branch information
Cryolitia committed Oct 17, 2024
1 parent 0796896 commit 0094376
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tools/mfd_aes_brute/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0094376

Please sign in to comment.