From b44a8d7f1fce1639ba7fb0c03ef5fc5c928b9933 Mon Sep 17 00:00:00 2001
From: dgelessus <dgelessus@users.noreply.github.com>
Date: Mon, 16 Jan 2023 17:03:53 +0100
Subject: [PATCH] Pull out common parts of method Makefiles into
 method_common.mk

---
 src/methods/adaboost/Makefile                   | 8 +-------
 src/methods/approx_kfn/Makefile                 | 8 +-------
 src/methods/bayesian_linear_regression/Makefile | 8 +-------
 src/methods/dbscan/Makefile                     | 8 +-------
 src/methods/decision_tree/Makefile              | 8 +-------
 src/methods/emst/Makefile                       | 8 +-------
 src/methods/fastmks/Makefile                    | 8 +-------
 src/methods/hoeffding_tree/Makefile             | 8 +-------
 src/methods/kde/Makefile                        | 8 +-------
 src/methods/kernel_pca/Makefile                 | 8 +-------
 src/methods/kfn/Makefile                        | 8 +-------
 src/methods/kmeans/Makefile                     | 8 +-------
 src/methods/knn/Makefile                        | 8 +-------
 src/methods/lars/Makefile                       | 8 +-------
 src/methods/linear_SVM/Makefile                 | 8 +-------
 src/methods/linear_regression/Makefile          | 8 +-------
 src/methods/lmnn/Makefile                       | 8 +-------
 src/methods/local_coordinate_coding/Makefile    | 8 +-------
 src/methods/logistic_regression/Makefile        | 8 +-------
 src/methods/lsh/Makefile                        | 8 +-------
 src/methods/mean_shift/Makefile                 | 8 +-------
 src/methods/method_common.mk                    | 8 ++++++++
 src/methods/naive_bayes_classifier/Makefile     | 8 +-------
 src/methods/nca/Makefile                        | 8 +-------
 src/methods/nmf/Makefile                        | 8 +-------
 src/methods/pca/Makefile                        | 8 +-------
 src/methods/perceptron/Makefile                 | 8 +-------
 src/methods/radical/Makefile                    | 8 +-------
 src/methods/random_forest/Makefile              | 8 +-------
 src/methods/softmax_regression/Makefile         | 8 +-------
 src/methods/sparse_coding/Makefile              | 8 +-------
 31 files changed, 38 insertions(+), 210 deletions(-)
 create mode 100644 src/methods/method_common.mk

diff --git a/src/methods/adaboost/Makefile b/src/methods/adaboost/Makefile
index 8eda7ce..ffc46ec 100644
--- a/src/methods/adaboost/Makefile
+++ b/src/methods/adaboost/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=adaboost
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/approx_kfn/Makefile b/src/methods/approx_kfn/Makefile
index b1685a9..59f360d 100644
--- a/src/methods/approx_kfn/Makefile
+++ b/src/methods/approx_kfn/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=approx_kfn
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/bayesian_linear_regression/Makefile b/src/methods/bayesian_linear_regression/Makefile
index ac7294e..dcc5a20 100644
--- a/src/methods/bayesian_linear_regression/Makefile
+++ b/src/methods/bayesian_linear_regression/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=bayesian_linear_regression
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
\ No newline at end of file
+include ../method_common.mk
diff --git a/src/methods/dbscan/Makefile b/src/methods/dbscan/Makefile
index f77df52..643b17d 100644
--- a/src/methods/dbscan/Makefile
+++ b/src/methods/dbscan/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=dbscan
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/decision_tree/Makefile b/src/methods/decision_tree/Makefile
index 7a9b569..2a88f2e 100644
--- a/src/methods/decision_tree/Makefile
+++ b/src/methods/decision_tree/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=decision_tree
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/emst/Makefile b/src/methods/emst/Makefile
index 8dc7eeb..6168624 100644
--- a/src/methods/emst/Makefile
+++ b/src/methods/emst/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=emst
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/fastmks/Makefile b/src/methods/fastmks/Makefile
index 5295563..58954ec 100644
--- a/src/methods/fastmks/Makefile
+++ b/src/methods/fastmks/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=fastmks
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/hoeffding_tree/Makefile b/src/methods/hoeffding_tree/Makefile
index d37037f..05ce3b2 100644
--- a/src/methods/hoeffding_tree/Makefile
+++ b/src/methods/hoeffding_tree/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=hoeffding_tree
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/kde/Makefile b/src/methods/kde/Makefile
index 5af26c9..b524c7b 100644
--- a/src/methods/kde/Makefile
+++ b/src/methods/kde/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=kde
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/kernel_pca/Makefile b/src/methods/kernel_pca/Makefile
index 76bab97..998f887 100644
--- a/src/methods/kernel_pca/Makefile
+++ b/src/methods/kernel_pca/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=kernel_pca
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/kfn/Makefile b/src/methods/kfn/Makefile
index ab06e3e..689985a 100644
--- a/src/methods/kfn/Makefile
+++ b/src/methods/kfn/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=kfn
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/kmeans/Makefile b/src/methods/kmeans/Makefile
index ddaebe1..dc05cdd 100644
--- a/src/methods/kmeans/Makefile
+++ b/src/methods/kmeans/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=kmeans
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/knn/Makefile b/src/methods/knn/Makefile
index 6dceec3..9778bda 100644
--- a/src/methods/knn/Makefile
+++ b/src/methods/knn/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=knn
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/lars/Makefile b/src/methods/lars/Makefile
index 653dfb4..8019c76 100644
--- a/src/methods/lars/Makefile
+++ b/src/methods/lars/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=lars
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/linear_SVM/Makefile b/src/methods/linear_SVM/Makefile
index 97760da..7460dda 100644
--- a/src/methods/linear_SVM/Makefile
+++ b/src/methods/linear_SVM/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=linear_SVM
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/linear_regression/Makefile b/src/methods/linear_regression/Makefile
index 71995e2..c401592 100644
--- a/src/methods/linear_regression/Makefile
+++ b/src/methods/linear_regression/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=linear_regression
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/lmnn/Makefile b/src/methods/lmnn/Makefile
index 7e808a5..0d49048 100644
--- a/src/methods/lmnn/Makefile
+++ b/src/methods/lmnn/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=lmnn
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/local_coordinate_coding/Makefile b/src/methods/local_coordinate_coding/Makefile
index 772fcca..02ffbda 100644
--- a/src/methods/local_coordinate_coding/Makefile
+++ b/src/methods/local_coordinate_coding/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=local_coordinate_coding
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/logistic_regression/Makefile b/src/methods/logistic_regression/Makefile
index c22417f..df8c036 100644
--- a/src/methods/logistic_regression/Makefile
+++ b/src/methods/logistic_regression/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=logistic_regression
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/lsh/Makefile b/src/methods/lsh/Makefile
index b520001..c296a0d 100644
--- a/src/methods/lsh/Makefile
+++ b/src/methods/lsh/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=lsh
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/mean_shift/Makefile b/src/methods/mean_shift/Makefile
index bcb68d0..94e7a5d 100644
--- a/src/methods/mean_shift/Makefile
+++ b/src/methods/mean_shift/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=mean_shift
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/method_common.mk b/src/methods/method_common.mk
new file mode 100644
index 0000000..726a9ed
--- /dev/null
+++ b/src/methods/method_common.mk
@@ -0,0 +1,8 @@
+# The including Makefile must set METHOD_NAME
+
+splfr=/usr/local/sicstus4.7.1/bin/splfr
+
+$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
+	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
+clean:
+	rm $(METHOD_NAME).so
diff --git a/src/methods/naive_bayes_classifier/Makefile b/src/methods/naive_bayes_classifier/Makefile
index c5e6449..1c268b2 100644
--- a/src/methods/naive_bayes_classifier/Makefile
+++ b/src/methods/naive_bayes_classifier/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=naive_bayes_classifier
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/nca/Makefile b/src/methods/nca/Makefile
index eac493d..bb5f059 100644
--- a/src/methods/nca/Makefile
+++ b/src/methods/nca/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=nca
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/nmf/Makefile b/src/methods/nmf/Makefile
index 387b1e0..6356489 100644
--- a/src/methods/nmf/Makefile
+++ b/src/methods/nmf/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=nmf
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/pca/Makefile b/src/methods/pca/Makefile
index 7e86acf..11667b6 100644
--- a/src/methods/pca/Makefile
+++ b/src/methods/pca/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=pca
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/perceptron/Makefile b/src/methods/perceptron/Makefile
index 3911c13..b71d203 100644
--- a/src/methods/perceptron/Makefile
+++ b/src/methods/perceptron/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=perceptron
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/radical/Makefile b/src/methods/radical/Makefile
index c78ed74..87ad93c 100644
--- a/src/methods/radical/Makefile
+++ b/src/methods/radical/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=radical
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/random_forest/Makefile b/src/methods/random_forest/Makefile
index ebaf94f..a0ac13a 100644
--- a/src/methods/random_forest/Makefile
+++ b/src/methods/random_forest/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=random_forest
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/softmax_regression/Makefile b/src/methods/softmax_regression/Makefile
index bd46077..5c3bc0a 100644
--- a/src/methods/softmax_regression/Makefile
+++ b/src/methods/softmax_regression/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=softmax_regression
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
diff --git a/src/methods/sparse_coding/Makefile b/src/methods/sparse_coding/Makefile
index fa08d89..c263e91 100644
--- a/src/methods/sparse_coding/Makefile
+++ b/src/methods/sparse_coding/Makefile
@@ -1,8 +1,2 @@
-splfr=/usr/local/sicstus4.7.1/bin/splfr
-
 METHOD_NAME=sparse_coding
-
-$(METHOD_NAME).so: $(METHOD_NAME).pl $(METHOD_NAME).cpp
-	$(splfr) -larmadillo -fopenmp -lmlpack -lstdc++ -cxx --struct $(METHOD_NAME).pl $(METHOD_NAME).cpp ../../helper_files/helper.cpp
-clean:
-	rm $(METHOD_NAME).so
+include ../method_common.mk
-- 
GitLab