--- Makefile.orig	2014-02-10 17:50:38.000000000 +0400
+++ Makefile	2014-03-03 12:12:12.000000000 +0400
@@ -4,14 +4,15 @@
 #   - Use "x86" for a build on x86 (32-bits)
 #   - Use "amd64" for a build on x86_64 (64-bits)
 #   - Use "nojit" for unsupported architectures.
-ifeq ($(shell arch),x86_64)
-export DYNAMIPS_ARCH?=amd64
+ifndef DYNAMIPS_ARCH
+ifneq ($(findstring $(shell uname -m),x86_64 amd64),)
+DYNAMIPS_ARCH=amd64
+else ifneq ($(findstring $(shell uname -m),i686 i386),)
+DYNAMIPS_ARCH=x86
 else
-ifeq ($(shell arch),i686)
-export DYNAMIPS_ARCH?=x86
-else
-export DYNAMIPS_ARCH?=nojit
+DYNAMIPS_ARCH=nojit
 endif
+export DYNAMIPS_ARCH
 endif
 
 # For MAC x64 you can compile the "unstable" version, which should work
