From 7a8bd080343b18578d1e915681c0551e1c1f5573 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Fri, 3 Jul 2020 13:37:50 +0100
Subject: [PATCH] MNT: Clean up, and compile shared not static

---
 Makefile       | 25 +++++--------------------
 branchname.log |  1 -
 quick.cc       | 42 ------------------------------------------
 3 files changed, 5 insertions(+), 63 deletions(-)
 delete mode 100644 branchname.log
 delete mode 100644 quick.cc

diff --git a/Makefile b/Makefile
index 16c67b8..e554c0d 100644
--- a/Makefile
+++ b/Makefile
@@ -3,29 +3,14 @@
 include ${FSLCONFDIR}/default.mk
 
 PROJNAME = miscmaths
-
-USRINCFLAGS = -I${INC_NEWMAT} -I${INC_BOOST} -I${INC_CPROB}
-USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_CPROB}
+LIBS     = -lfsl-utils -lfsl-cprob
+SOFILES  = libfsl-miscmaths.so
 
 USRCXXFLAGS = -std=c++11
 
 OBJS = miscmaths.o optimise.o miscprob.o kernel.o histogram.o base2z.o t2z.o f2z.o minimize.o cspline.o sparse_matrix.o sparsefn.o rungekutta.o nonlin.o bfmatrix.o Simplex.o SpMatMatrices.o
 
-LIBS = -lutils -lcprob -lm
-
-# The target "all" should ALWAYS be provided
-#   typically it will just be another target name
-
-all: libmiscmaths.a
-
-quick:${OBJS} quick.o
-	${CXX}  ${CXXFLAGS} ${LDFLAGS} -o $@ ${OBJS} quick.o ${LIBS}
-
-libmiscmaths.a: ${OBJS}
-	${AR} -r libmiscmaths.a ${OBJS}
-
-%.o:%.cpp
-	$(CXX11) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
+all: libfsl-miscmaths.so
 
-%.o:%.cc
-	$(CXX11) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
+libfsl-miscmaths.so: ${OBJS}
+	$(CXX) $(CXXFLAGS) -shared -o $@ $^
diff --git a/branchname.log b/branchname.log
deleted file mode 100644
index c44a2e2..0000000
--- a/branchname.log
+++ /dev/null
@@ -1 +0,0 @@
-Initial creation of branchname log file
diff --git a/quick.cc b/quick.cc
deleted file mode 100644
index 8efafec..0000000
--- a/quick.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-/*  quick.cc
-
-    Mark Woolrich, FMRIB Image Analysis Group
-
-    Copyright (C) 1999-2000 University of Oxford  */
-
-/*  CCOPYRIGHT  */
-
-#include <iostream>
-#include <fstream>
-#include <iomanip>
-#include <sstream>
-#define WANT_STREAM
-#define WANT_MATH
-
-#include "miscmaths.h"
-#include "t2z.h"
-
-using namespace MISCMATHS;
-
-int main(int argc, char *argv[])
-{
-  try{
-
-    Matrix X = read_vest("/usr/people/woolrich/matlab/vbbabe/data/design2.mat").t();
-
-    ColumnVector Y = read_vest("/usr/people/woolrich/matlab/vbbabe/data/sdf2.mat").t();
-
-    ColumnVector m_B;
-    SymmetricMatrix ilambda_B;
-
-    glm_vb(X, Y, m_B, ilambda_B, 30);
-
-    write_ascii_matrix(m_B,"/usr/people/woolrich/matlab/vbbabe/data/m_B");
-
-  }
-  catch(Exception p_excp)
-    {
-      cerr << p_excp.what() << endl;
-    }
-  return 0;
-}
-- 
GitLab