From dd2c894d691cb90b5ae08f7e51e8b1daedb4ea68 Mon Sep 17 00:00:00 2001
From: Antonis Anastasiadis <antanst@antanst.com>
Date: Mon, 11 Feb 2019 16:51:34 +0200
Subject: [PATCH] Use portable uname flag, handle OpenBSD case of amd64

---
 makefile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/makefile b/makefile
index 77788dc..388d5b4 100644
--- a/makefile
+++ b/makefile
@@ -1,8 +1,11 @@
 #CXX=g++-8
 #CC=gcc-8
-PLATFORM=$(shell uname -i)
+PLATFORM=$(shell uname -m)
 CXXFLAGS=-std=c++11
 CCFLAGS=
+ifeq ($(PLATFORM),amd64)
+    CXXFLAGS += -maes
+endif
 ifeq ($(PLATFORM),x86_64)
     CXXFLAGS += -maes
 endif
@@ -12,6 +15,9 @@ OBJDIR=obj
 LDFLAGS=-lpthread
 TOBJS=$(addprefix $(OBJDIR)/,instructionsPortable.o TestAluFpu.o)
 ROBJS=$(addprefix $(OBJDIR)/,argon2_core.o argon2_ref.o AssemblyGeneratorX86.o blake2b.o CompiledVirtualMachine.o dataset.o JitCompilerX86.o instructionsPortable.o Instruction.o InterpretedVirtualMachine.o main.o Program.o softAes.o VirtualMachine.o Cache.o virtualMemory.o divideByConstantCodegen.o LightClientAsyncWorker.o hashAes1Rx4.o)
+ifeq ($(PLATFORM),amd64)
+    ROBJS += $(OBJDIR)/JitCompilerX86-static.o $(OBJDIR)/squareHash.o
+endif
 ifeq ($(PLATFORM),x86_64)
     ROBJS += $(OBJDIR)/JitCompilerX86-static.o $(OBJDIR)/squareHash.o
 endif
@@ -114,4 +120,4 @@ $(BINDIR):
 	mkdir $(BINDIR)
 
 clean:
-	rm -f $(BINDIR)/randomx $(BINDIR)/AluFpuTest $(OBJDIR)/*.o
\ No newline at end of file
+	rm -f $(BINDIR)/randomx $(BINDIR)/AluFpuTest $(OBJDIR)/*.o