Make sure we detect the build architecture and also set properly the SONAME for the lib.
diff --git a/IsoSpec++/Makefile b/IsoSpec++/Makefile
index 31a2f94..bb02505 100644
--- a/IsoSpec++/Makefile
+++ b/IsoSpec++/Makefile
@@ -1,24 +1,71 @@
-OPTFLAGS=-O3 -march=native -mtune=native
+OPTFLAGS=-O3 -mtune=native
+# Now fix specific cases
+
+DEB_ARCH_FLAGS=$(shell dpkg-architecture -q DEB_BUILD_ARCH)
+
+ifeq (ppc64el,$(DEB_ARCH_FLAGS))
+	OPTFLAGS=-O3 -mcpu=native
+endif
+
+ifeq (alpha,$(DEB_ARCH_FLAGS))
+	OPTFLAGS=-O3 -mtune=native
+endif
+
+ifeq (hppa,$(DEB_ARCH_FLAGS))
+	OPTFLAGS=-O3
+endif
+
+ifeq (m68k,$(DEB_ARCH_FLAGS))
+	OPTFLAGS=-O3
+endif
+
+ifeq (powerpc,$(DEB_ARCH_FLAGS))
+	OPTFLAGS=-O3 -mcpu=native
+endif
+
+ifeq (powerpcspe,$(DEB_ARCH_FLAGS))
+	OPTFLAGS=-O3 -mcpu=native
+endif
+
+ifeq (ppc64,$(DEB_ARCH_FLAGS))
+	OPTFLAGS=-O3 -mcpu=native
+endif
+
+ifeq (riscv64,$(DEB_ARCH_FLAGS))
+	OPTFLAGS=-O3
+endif
+
+ifeq (sh4,$(DEB_ARCH_FLAGS))
+	OPTFLAGS=-O3
+endif
+
+ifeq (sparc64,$(DEB_ARCH_FLAGS))
+	OPTFLAGS=-O3 -mcpu=native
+endif
+
+
 DEBUGFLAGS=-O0 -g -Werror
-CXXFLAGS=-std=c++11 -Wall -pedantic -Wextra
+CXXFLAGS=-std=c++11 -O0 -g -Wall -pedantic -Wextra
 SRCFILES=cwrapper.cpp allocator.cpp  dirtyAllocator.cpp  isoSpec++.cpp  isoMath.cpp  marginalTrek++.cpp  operators.cpp element_tables.cpp misc.cpp mman.c
+SOVER=1
+RELVER=$(SOVER).9.1
 
 all: unitylib
 
 unitylib:
-	$(CXX) $(CXXFLAGS) $(OPTFLAGS) unity-build.cpp -fPIC -shared -o libIsoSpec++.so
+	$(CXX) $(CXXFLAGS) $(OPTFLAGS) unity-build.cpp -fPIC -shared -o libIsoSpec++.so.$(RELVER) -Wl,-soname,libIsoSpec++.so.$(SOVER)
 
 debug:
-	$(CXX) $(CXXFLAGS) $(DEBUGFLAGS) unity-build.cpp -DDEBUG -fPIC -shared -o libIsoSpec++.so
+	$(CXX) $(CXXFLAGS) $(DEBUGFLAGS) unity-build.cpp -DDEBUG -fPIC -shared -o libIsoSpec++.so.$(RELVER) -Wl,-soname,libIsoSpec++.so.$(SOVER)
 
 debug-gcc:
-	g++ $(CXXFLAGS) $(DEBUGFLAGS) unity-build.cpp -DDEBUG -fPIC -shared -o libIsoSpec++.so
+	g++ $(CXXFLAGS) $(DEBUGFLAGS) unity-build.cpp -DDEBUG -fPIC -shared -o libIsoSpec++.so.$(RELVER) -Wl,-soname,libIsoSpec++.so.$(SOVER)
 
 nonunity:
-	$(CXX) $(CXXFLAGS) $(OPTFLAGS) $(SRCFILES) -DDEBUG -fPIC -shared -o libIsoSpec++.so
+	$(CXX) $(CXXFLAGS) $(OPTFLAGS) $(SRCFILES) -DDEBUG -fPIC -shared -o libIsoSpec++.so.$(RELVER) -Wl,-soname,libIsoSpec++.so.$(SOVER)
 
 clean:
-	rm -f libIsoSpec++.so
+	rm -f libIsoSpec++.so.$(SOVER)
 
 windows:
 	g++ -O3 -std=gnu++11 -O3 -shared -static -static-libstdc++ -static-libgcc unity-build.cpp -o ../IsoSpecPy/IsoSpec++.dll
