Author: Michael R. Crusoe <crusoe@debian.org>
Description: Generic build file using variable from dpkg-architecture
Forwarded: https://sourceforge.net/p/snap7/discussion/bugfix/thread/c5db84f5c9/
--- /dev/null
+++ snap7/build/unix/Makefile
@@ -0,0 +1,5 @@
+TargetCPU=${DEB_HOST_GNU_CPU}
+OS=${DEB_HOST_ARCH_OS}
+CXXFLAGS+=-O3 -fPIC -pedantic
+
+include common.mk
--- snap7.orig/build/unix/common.mk
+++ snap7/build/unix/common.mk
@@ -22,7 +22,7 @@
 IncludePath            :=  $(IncludeSwitch). $(IncludeSwitch)../../src/sys $(IncludeSwitch)../../src/core $(IncludeSwitch)../../src/lib 
 Libs                   := $(LibrarySwitch)pthread $(LibrarySwitch)rt 
 LibPath                := $(LibraryPathSwitch). 
-LibInstall             := /usr/lib
+LibInstall             := $(DESTDIR)/usr/lib
 
 ##
 ## Common variables (CXXFLAGS varies across platforms)
@@ -107,5 +107,6 @@
 	$(RM) $(OutputFile)
 
 install: all
+	mkdir --parents $(LibInstall)
 	cp -f $(OutputFile) $(LibInstall)
 
