--- Makefile.orig	2020-06-03 16:10:18
+++ Makefile	2024-06-10 12:05:37
@@ -1,3 +1,5 @@
+INSTALL := /usr/bin/install
+
 CXXFLAGS := -fPIC -std=c++0x -fvisibility=hidden -fvisibility-inlines-hidden
 
 PCH_HEADER := ./DLL430_v3/src/TI/DLL430/pch.h
@@ -18,6 +20,7 @@
 export BOOST_DIR
 export STATIC
 export DEBUG
+export PREFIX
 
 INCLUDES := \
 	-I./DLL430_v3/src/TI/DLL430 \
@@ -25,16 +28,16 @@
 	-I./DLL430_v3/src/TI/DLL430/EnergyTrace_TSPA \
 	-I./Bios/include \
 	-I./ThirdParty/include \
-	-I./ThirdParty/BSL430_DLL
+	-I./ThirdParty/BSL430_DLL \
+        -I$(PREFIX)/include/hidapi
 
+LIBS := -L$(PREFIX)/lib
+STATIC_LIBS := -L$(PREFIX)/libmsp430/lib
 
-LIBS :=
-STATIC_LIBS :=
-
 ifdef STATIC
-STATIC_LIBS += -lboost_filesystem -lboost_system -lbsl430 -lboost_date_time -lboost_chrono -lboost_thread
+STATIC_LIBS += -lboost_filesystem-mt -lboost_system-mt -lbsl430 -lboost_date_time-mt -lboost_chrono-mt -lboost_thread-mt
 else
-LIBS += -lboost_filesystem -lboost_system -lbsl430 -lboost_date_time -lboost_chrono -lboost_thread
+LIBS += -lboost_filesystem-mt -lboost_system-mt -lbsl430 -lboost_date_time-mt -lboost_chrono-mt -lboost_thread-mt
 endif
 
 LIBTHIRD := ./ThirdParty/lib64
@@ -43,7 +46,7 @@
 PLATFORM := $(shell uname -s)
 ifeq ($(PLATFORM),Linux)
 	CXX:= g++
-	
+
 	STATICOUTPUT := linux64
 
 	OUTPUT := libmsp430.so
@@ -123,7 +126,7 @@
 OBJS := $(patsubst %.cpp, %.o, $(SRC))
 
 all: $(BSLLIB) $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OUTNAME)$(OUTPUT) -o $(OUTPUT) $(OBJS) $(HIDOBJ) $(LIBDIRS) $(BSTATIC) $(STATIC_LIBS) $(BDYNAMIC) $(LIBS)
+	$(CXX) $(CXXFLAGS) -shared $(OUTNAME) $(OUTPUT) -o $(OUTPUT) $(OBJS) $(HIDOBJ) $(LIBDIRS) $(BSTATIC) $(STATIC_LIBS) $(BDYNAMIC) $(LIBS)
 	rm -f $(STATICOUTPUT).a
 	ar -rs $(STATICOUTPUT).a $(OBJS)
 
@@ -134,10 +137,11 @@
 	$(CXX) -c -o $@ $< $(USE_PCH) $(CXXFLAGS) $(INCLUDES) $(DEFINES)
 
 $(BSLLIB):
-	$(MAKE) -C ./ThirdParty/BSL430_DLL
+	$(MAKE) PREFIX=$(PREFIX) -C ./ThirdParty/BSL430_DLL
 
 install:
-	cp $(OUTPUT) /usr/local/lib/
+	mkdir -p $(DESTDIR)/$(PREFIX)/lib/
+	$(INSTALL) $(OUTPUT) $(DESTDIR)/$(PREFIX)/lib/
 
 clean:
 	$(MAKE) -C ./ThirdParty/BSL430_DLL clean
