From 0443a6002557c1b65c2fe077e3f68281085df7c1 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 15 Sep 2023 19:08:24 +0200 Subject: [PATCH] adapt Makefile to use MYxxxx flags instead --- tools/cryptorf/Makefile | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tools/cryptorf/Makefile b/tools/cryptorf/Makefile index 96ac9393d..75fe80644 100644 --- a/tools/cryptorf/Makefile +++ b/tools/cryptorf/Makefile @@ -4,6 +4,18 @@ MYINCLUDES = -I../../common/cryptorf MYCFLAGS = MYDEFS = +# 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 + MYCFLAGS += -march=native +endif + platform = $(shell uname) # Atomic @@ -11,14 +23,14 @@ platform = $(shell uname) # but MacOSX /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld # doesn't recognize option --as-needed ifneq ($(platform),Darwin) - LDLIBS += -lpthread -Wl,--as-needed -latomic -Wl,--no-as-needed + MYLDLIBS += -lpthread -Wl,--as-needed -latomic -Wl,--no-as-needed endif BINS = cm sm sma sma_multi INSTALLTOOLS = $(BINS) ifeq ($(platform),Darwin) - CXXFLAGS = -std=c++14 + MYCXXFLAGS = -std=c++14 endif include ../../Makefile.host @@ -27,7 +39,7 @@ include ../../Makefile.host ifneq (,$(findstring MINGW,$(platform))) # Mingw uses by default Microsoft printf, we want the GNU printf (e.g. for %z) # and setting _ISOC99_SOURCE sets internally __USE_MINGW_ANSI_STDIO=1 - CFLAGS += -D_ISOC99_SOURCE + MYCFLAGS += -D_ISOC99_SOURCE endif cm : $(OBJDIR)/cm.o $(MYOBJS)