From 135b1650f11ce982577086135580d4b5ed32c4b9 Mon Sep 17 00:00:00 2001
From: Axel Kohlmeyer <akohlmey@gmail.com>
Date: Mon, 7 Aug 2017 17:13:01 -0400
Subject: [PATCH] revamp of library builds

- remove cross compiler stuff
- make use of Install.py consistent
- provide options for Makefile.serial and Makefile.mpi that match those in src
---
 lib/.gitignore                         |  1 +
 lib/Install.py                         | 24 ++++++---
 lib/awpmd/Makefile.mpi                 | 71 ++++++++++++++++++++++++++
 lib/awpmd/Makefile.mpicc               |  8 +--
 lib/awpmd/Makefile.serial              | 71 ++++++++++++++++++++++++++
 lib/colvars/Install.py                 | 10 ++--
 lib/colvars/Makefile.lammps            |  5 --
 lib/colvars/Makefile.mingw32-cross     | 31 -----------
 lib/colvars/Makefile.mingw32-cross-mpi | 13 -----
 lib/colvars/Makefile.mingw64-cross     | 31 -----------
 lib/colvars/Makefile.mingw64-cross-mpi | 13 -----
 lib/colvars/Makefile.mpi               | 25 +++++++++
 lib/colvars/Makefile.serial            | 25 +++++++++
 lib/h5md/Makefile.h5cc                 | 11 ++--
 lib/linalg/Install.py                  | 58 ---------------------
 lib/linalg/Makefile.gfortran           |  8 ++-
 lib/linalg/Makefile.mingw32-cross      | 67 ------------------------
 lib/linalg/Makefile.mingw32-cross-mpi  | 13 -----
 lib/linalg/Makefile.mingw64-cross      | 67 ------------------------
 lib/linalg/Makefile.mingw64-cross-mpi  | 13 -----
 lib/linalg/Makefile.serial             |  1 +
 21 files changed, 231 insertions(+), 335 deletions(-)
 create mode 100644 lib/awpmd/Makefile.mpi
 create mode 100644 lib/awpmd/Makefile.serial
 delete mode 100644 lib/colvars/Makefile.lammps
 delete mode 100644 lib/colvars/Makefile.mingw32-cross
 delete mode 100644 lib/colvars/Makefile.mingw32-cross-mpi
 delete mode 100644 lib/colvars/Makefile.mingw64-cross
 delete mode 100644 lib/colvars/Makefile.mingw64-cross-mpi
 create mode 100644 lib/colvars/Makefile.mpi
 create mode 100644 lib/colvars/Makefile.serial
 delete mode 100644 lib/linalg/Install.py
 delete mode 100644 lib/linalg/Makefile.mingw32-cross
 delete mode 100644 lib/linalg/Makefile.mingw32-cross-mpi
 delete mode 100644 lib/linalg/Makefile.mingw64-cross
 delete mode 100644 lib/linalg/Makefile.mingw64-cross-mpi
 create mode 120000 lib/linalg/Makefile.serial

diff --git a/lib/.gitignore b/lib/.gitignore
index cbeae7705e..4f9ebba6a5 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -1,2 +1,3 @@
 Makefile.lammps
 .depend
+Makefile.auto
diff --git a/lib/Install.py b/lib/Install.py
index 6b90254336..416a2319c6 100644
--- a/lib/Install.py
+++ b/lib/Install.py
@@ -70,23 +70,31 @@ if not os.path.exists("Makefile.%s" % machine):
 lines = open("Makefile.%s" % machine,'r').readlines()
 fp = open("Makefile.auto",'w')
 
+has_extramake = False
 for line in lines:
   words = line.split()
-  if len(words) == 3 and extraflag and \
-        words[0] == "EXTRAMAKE" and words[1] == '=':
-    line = line.replace(words[2],"Makefile.lammps.%s" % suffix)
-  print >>fp,line,
+  if len(words) == 3 and words[0] == "EXTRAMAKE" and words[1] == '=':
+    has_extramake = True
+    if extraflag:
+      line = line.replace(words[2],"Makefile.lammps.%s" % suffix)
+  fp.write(line)
 
 fp.close()
 
-# make the library via Makefile.auto
+# make the library via Makefile.auto optionally with parallel make
+
+try:
+  import multiprocessing
+  n_cpus = multiprocessing.cpu_count()
+except:
+  n_cpus = 1
 
 print("Building lib%s.a ..." % lib)
-cmd = "make -f Makefile.auto clean; make -f Makefile.auto"
+cmd = "make -f Makefile.auto clean; make -f Makefile.auto -j%d" % n_cpus
 txt = subprocess.check_output(cmd,shell=True,stderr=subprocess.STDOUT)
-print(txt)
+print(txt.decode('UTF-8'))
 
 if os.path.exists("lib%s.a" % lib): print("Build was successful")
 else: error("Build of lib/%s/lib%s.a was NOT successful" % (lib,lib))
-if not os.path.exists("Makefile.lammps"):
+if has_extramake and not os.path.exists("Makefile.lammps"):
   print("lib/%s/Makefile.lammps was NOT created" % lib)
diff --git a/lib/awpmd/Makefile.mpi b/lib/awpmd/Makefile.mpi
new file mode 100644
index 0000000000..e4b424e776
--- /dev/null
+++ b/lib/awpmd/Makefile.mpi
@@ -0,0 +1,71 @@
+SHELL = /bin/sh
+
+# which file will be copied to Makefile.lammps
+
+EXTRAMAKE = Makefile.lammps.linalg
+
+# ------ FILES ------
+
+SRC = \
+    ivutils/src/logexc.cpp \
+    systems/interact/TCP/wpmd.cpp \
+    systems/interact/TCP/wpmd_split.cpp
+
+INC = \
+    cerf.h \
+    cerf2.h \
+    cerf_octave.h \
+    cvector_3.h \
+    lapack_inter.h \
+    logexc.h \
+    pairhash.h \
+    refobj.h \
+    tcpdefs.h \
+    vector_3.h \
+    wavepacket.h \
+    wpmd.h \
+    wpmd_split.h
+
+# ------ DEFINITIONS ------
+
+LIB = libawpmd.a
+OBJ =   $(SRC:.cpp=.o)
+
+# ------ SETTINGS ------
+
+# include any MPI settings needed for the ATC library to build with
+# the same MPI library that LAMMPS is built with
+
+CC =	    mpicxx
+CCFLAGS = -O3 -fPIC -Isystems/interact/TCP/ -Isystems/interact -Iivutils/include \
+	  -DMPICH_IGNORE_CXX_SEEK -DOMPI_SKIP_MPICXX=1
+
+ARCHIVE =	ar
+ARCHFLAG =	-rc
+DEPFLAGS =  -M
+#LINK =         
+#LINKFLAGS =	
+USRLIB =
+SYSLIB =
+
+# ------ MAKE PROCEDURE ------
+
+lib: 	$(OBJ)
+	$(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ)
+	@cp $(EXTRAMAKE) Makefile.lammps
+
+# ------ COMPILE RULES ------
+
+%.o:%.cpp
+	$(CC) $(CCFLAGS) -c $< -o $@
+%.d:%.cpp
+	$(CC) $(CCFLAGS) $(DEPFLAGS) $< > $@		
+
+# ------ DEPENDENCIES ------
+
+DEPENDS = $(OBJ:.o=.d)
+
+# ------ CLEAN ------
+
+clean:
+	-rm -f *.d *~ $(OBJ) $(LIB)
diff --git a/lib/awpmd/Makefile.mpicc b/lib/awpmd/Makefile.mpicc
index 4c289ad88a..5cf6a75bd7 100644
--- a/lib/awpmd/Makefile.mpicc
+++ b/lib/awpmd/Makefile.mpicc
@@ -36,8 +36,10 @@ OBJ =   $(SRC:.cpp=.o)
 # include any MPI settings needed for the ATC library to build with
 # the same MPI library that LAMMPS is built with
 
-CC =	    mpic++ 
-CCFLAGS = -O -fPIC -Isystems/interact/TCP/ -Isystems/interact -Iivutils/include
+CC =	    mpicxx
+CCFLAGS = -O3 -fPIC -Isystems/interact/TCP/ -Isystems/interact -Iivutils/include \
+	  -DMPICH_IGNORE_CXX_SEEK -DOMPI_SKIP_MPICXX=1
+
 ARCHIVE =	ar
 ARCHFLAG =	-rc
 DEPFLAGS =  -M
@@ -66,4 +68,4 @@ DEPENDS = $(OBJ:.o=.d)
 # ------ CLEAN ------
 
 clean:
-	-rm *.d *~ $(OBJ) $(LIB)
+	-rm -f *.d *~ $(OBJ) $(LIB)
diff --git a/lib/awpmd/Makefile.serial b/lib/awpmd/Makefile.serial
new file mode 100644
index 0000000000..f51714fc9a
--- /dev/null
+++ b/lib/awpmd/Makefile.serial
@@ -0,0 +1,71 @@
+SHELL = /bin/sh
+
+# which file will be copied to Makefile.lammps
+
+EXTRAMAKE = Makefile.lammps.linalg
+
+# ------ FILES ------
+
+SRC = \
+    ivutils/src/logexc.cpp \
+    systems/interact/TCP/wpmd.cpp \
+    systems/interact/TCP/wpmd_split.cpp
+
+INC = \
+    cerf.h \
+    cerf2.h \
+    cerf_octave.h \
+    cvector_3.h \
+    lapack_inter.h \
+    logexc.h \
+    pairhash.h \
+    refobj.h \
+    tcpdefs.h \
+    vector_3.h \
+    wavepacket.h \
+    wpmd.h \
+    wpmd_split.h
+
+# ------ DEFINITIONS ------
+
+LIB = libawpmd.a
+OBJ =   $(SRC:.cpp=.o)
+
+# ------ SETTINGS ------
+
+# include any MPI settings needed for the ATC library to build with
+# the same MPI library that LAMMPS is built with
+
+CC =	    g++
+CCFLAGS = -O3 -fPIC -Isystems/interact/TCP/ -Isystems/interact -Iivutils/include \
+	  -I../../src/STUBS
+
+ARCHIVE =	ar
+ARCHFLAG =	-rc
+DEPFLAGS =  -M
+#LINK =         
+#LINKFLAGS =	
+USRLIB =
+SYSLIB =
+
+# ------ MAKE PROCEDURE ------
+
+lib: 	$(OBJ)
+	$(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ)
+	@cp $(EXTRAMAKE) Makefile.lammps
+
+# ------ COMPILE RULES ------
+
+%.o:%.cpp
+	$(CC) $(CCFLAGS) -c $< -o $@
+%.d:%.cpp
+	$(CC) $(CCFLAGS) $(DEPFLAGS) $< > $@		
+
+# ------ DEPENDENCIES ------
+
+DEPENDS = $(OBJ:.o=.d)
+
+# ------ CLEAN ------
+
+clean:
+	-rm -f *.d *~ $(OBJ) $(LIB)
diff --git a/lib/colvars/Install.py b/lib/colvars/Install.py
index 2fc207710c..01e70543f2 100644
--- a/lib/colvars/Install.py
+++ b/lib/colvars/Install.py
@@ -13,7 +13,7 @@ Syntax from lib/colvars dir: python Install.py -m machine -e suffix
 
 specify -m and optionally -e, order does not matter
 
-  -m = peform a clean followed by "make -f Makefile.machine"
+  -m = delete all existing objects, followed by "make -f Makefile.machine"
        machine = suffix of a lib/colvars/Makefile.* or of a
          src/MAKE/MACHINES/Makefile.* file
   -e = set EXTRAMAKE variable in Makefile.machine to Makefile.lammps.suffix
@@ -21,7 +21,7 @@ specify -m and optionally -e, order does not matter
 
 Examples:
 
-make lib-colvars args="-m g++"     # build COLVARS lib with GNU g++ compiler
+make lib-colvars args="-m mpi"     # build COLVARS lib with default mpi compiler wrapper
 """
 
 # print error message or help
@@ -122,7 +122,7 @@ for line in lines:
   fp.write(line)
 fp.close()
 
-# make the library via Makefile.auto
+# make the library via Makefile.auto optionally with parallel make
 
 try:
   import multiprocessing
@@ -132,9 +132,9 @@ except:
 
 print("Building lib%s.a ..." % lib)
 cmd = ["make -f Makefile.auto clean"]
-print(subprocess.check_output(cmd, shell=True).decode())
+print(subprocess.check_output(cmd, shell=True).decode('UTF-8'))
 cmd = ["make -f Makefile.auto -j%d" % n_cpus]
-print(subprocess.check_output(cmd, shell=True).decode())
+print(subprocess.check_output(cmd, shell=True).decode('UTF-8'))
 
 if os.path.exists("lib%s.a" % lib): print("Build was successful")
 else: error("Build of lib/%s/lib%s.a was NOT successful" % (lib,lib))
diff --git a/lib/colvars/Makefile.lammps b/lib/colvars/Makefile.lammps
deleted file mode 100644
index 99f57b050b..0000000000
--- a/lib/colvars/Makefile.lammps
+++ /dev/null
@@ -1,5 +0,0 @@
-# Settings that the LAMMPS build will import when this package library is used
-
-colvars_SYSINC =
-colvars_SYSLIB =
-colvars_SYSPATH =
diff --git a/lib/colvars/Makefile.mingw32-cross b/lib/colvars/Makefile.mingw32-cross
deleted file mode 100644
index 29c64b26a2..0000000000
--- a/lib/colvars/Makefile.mingw32-cross
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- makefile -*- to build Colvars module with MinGW 32-bit
-
-EXTRAMAKE = Makefile.lammps.empty
-
-COLVARS_LIB = libcolvars.a
-COLVARS_OBJ_DIR = Obj_mingw64/
-
-CXX =		i686-w64-mingw32-g++
-CXXFLAGS =	-O2 -march=i686 -mtune=generic -mfpmath=387 -mpc64	\
-		-fno-rtti -fno-exceptions -finline-functions		\
-                -ffast-math -funroll-loops -fstrict-aliasing		\
-                -Wall -W -Wno-uninitialized
-AR =		i686-w64-mingw32-ar
-ARFLAGS =	-rscv
-SHELL =		/bin/sh
-
-.PHONY: default clean
-
-default: $(COLVARS_OBJ_DIR) $(COLVARS_LIB) Makefile.lammps
-
-include Makefile.common
-
-$(COLVARS_OBJ_DIR):
-	mkdir $(COLVARS_OBJ_DIR)
-
-clean:
-	-rm -f $(COLVARS_OBJS) $(COLVARS_LIB)
-	-rmdir $(COLVARS_OBJ_DIR)
-
-Makefile.lammps:
-	-cp $(EXTRAMAKE) Makefile.lammps
diff --git a/lib/colvars/Makefile.mingw32-cross-mpi b/lib/colvars/Makefile.mingw32-cross-mpi
deleted file mode 100644
index 1e35c5b461..0000000000
--- a/lib/colvars/Makefile.mingw32-cross-mpi
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- makefile -*- wrapper for non-MPI libraries
-
-SHELL=/bin/sh
-
-all:
-	$(MAKE) $(MFLAGS) mingw32-cross
-	-rm -f Obj_mingw32-mpi
-	ln -s Obj_mingw32 Obj_mingw32-mpi
-
-clean:
-	$(MAKE) $(MFLAGS) clean-mingw32-cross
-	-rm -f Obj_mingw32-mpi
-
diff --git a/lib/colvars/Makefile.mingw64-cross b/lib/colvars/Makefile.mingw64-cross
deleted file mode 100644
index 2fd1c6fc67..0000000000
--- a/lib/colvars/Makefile.mingw64-cross
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- makefile -*- to build Colvars module with MinGW 32-bit
-
-EXTRAMAKE = Makefile.lammps.empty
-
-COLVARS_LIB = libcolvars.a
-COLVARS_OBJ_DIR = Obj_mingw32/
-
-CXX =		x86_64-w64-mingw32-g++
-CXXFLAGS =	-O2 -march=core2 -mtune=core2 -mpc64 -msse2		\
-		-fno-rtti -fno-exceptions -finline-functions		\
-                -ffast-math -funroll-loops -fstrict-aliasing		\
-                -Wall -W -Wno-uninitialized
-AR =		x86_64-w64-mingw32-ar
-ARFLAGS =	-rscv
-SHELL =		/bin/sh
-
-.PHONY: default clean
-
-default: $(COLVARS_OBJ_DIR) $(COLVARS_LIB) Makefile.lammps
-
-include Makefile.common
-
-$(COLVARS_OBJ_DIR):
-	mkdir $(COLVARS_OBJ_DIR)
-
-clean:
-	-rm -f $(COLVARS_OBJS) $(COLVARS_LIB)
-	-rmdir $(COLVARS_OBJ_DIR)
-
-Makefile.lammps:
-	-cp $(EXTRAMAKE) Makefile.lammps
diff --git a/lib/colvars/Makefile.mingw64-cross-mpi b/lib/colvars/Makefile.mingw64-cross-mpi
deleted file mode 100644
index ca6f4a6d43..0000000000
--- a/lib/colvars/Makefile.mingw64-cross-mpi
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- makefile -*- wrapper for non-MPI libraries
-
-SHELL=/bin/sh
-
-all:
-	$(MAKE) $(MFLAGS) mingw64-cross
-	-rm -f Obj_mingw64-mpi
-	ln -s Obj_mingw64 Obj_mingw64-mpi
-
-clean:
-	$(MAKE) $(MFLAGS) clean-mingw64-cross
-	-rm -f Obj_mingw64-mpi
-
diff --git a/lib/colvars/Makefile.mpi b/lib/colvars/Makefile.mpi
new file mode 100644
index 0000000000..6343ed7c06
--- /dev/null
+++ b/lib/colvars/Makefile.mpi
@@ -0,0 +1,25 @@
+# -*- makefile -*- to build Colvars module with default MPI compiler wrapper
+
+EXTRAMAKE = Makefile.lammps.empty
+
+COLVARS_LIB = libcolvars.a
+COLVARS_OBJ_DIR =
+
+CXX =		mpicxx
+CXXFLAGS =	-O2 -g -Wall -fPIC -funroll-loops
+AR =		ar
+ARFLAGS =	-rscv
+SHELL =		/bin/sh
+
+.PHONY: default clean
+
+default: $(COLVARS_LIB) Makefile.lammps
+
+include Makefile.common
+
+clean:
+	-rm -f $(COLVARS_OBJS) $(COLVARS_LIB)
+
+Makefile.lammps:
+	-cp $(EXTRAMAKE) Makefile.lammps
+
diff --git a/lib/colvars/Makefile.serial b/lib/colvars/Makefile.serial
new file mode 100644
index 0000000000..556e39d070
--- /dev/null
+++ b/lib/colvars/Makefile.serial
@@ -0,0 +1,25 @@
+# -*- makefile -*- to build Colvars module with GNU compiler
+
+EXTRAMAKE = Makefile.lammps.empty
+
+COLVARS_LIB = libcolvars.a
+COLVARS_OBJ_DIR =
+
+CXX =		g++
+CXXFLAGS =	-O2 -g -Wall -fPIC -funroll-loops
+AR =		ar
+ARFLAGS =	-rscv
+SHELL =		/bin/sh
+
+.PHONY: default clean
+
+default: $(COLVARS_LIB) Makefile.lammps
+
+include Makefile.common
+
+clean:
+	-rm -f $(COLVARS_OBJS) $(COLVARS_LIB)
+
+Makefile.lammps:
+	-cp $(EXTRAMAKE) Makefile.lammps
+
diff --git a/lib/h5md/Makefile.h5cc b/lib/h5md/Makefile.h5cc
index bd3e8a9784..9feed2d74e 100644
--- a/lib/h5md/Makefile.h5cc
+++ b/lib/h5md/Makefile.h5cc
@@ -9,12 +9,14 @@ HDF5_PATH=/usr
 INC=-I include
 AR=ar
 ARFLAGS=rc
-LIB=libch5md.a
+# need to build two libraries to not break compatibility and to support Install.py
+LIB=libh5md.a libch5md.a
 
 all: lib Makefile.lammps
 
 build:
 	mkdir -p build
+
 build/ch5md.o: src/ch5md.c | build
 	$(CC) $(INC) $(CFLAGS) -c $< -o $@
 
@@ -23,8 +25,11 @@ Makefile.lammps:
 
 .PHONY: all lib clean
 
-$(LIB): build/ch5md.o
-	$(AR) $(ARFLAGS) $(LIB) build/ch5md.o
+libch5md.a : build/ch5md.o
+	$(AR) $(ARFLAGS) $@ build/ch5md.o
+
+libh5md.a : build/ch5md.o
+	$(AR) $(ARFLAGS) $@ build/ch5md.o
 
 lib: $(LIB)
 
diff --git a/lib/linalg/Install.py b/lib/linalg/Install.py
deleted file mode 100644
index 560afecec4..0000000000
--- a/lib/linalg/Install.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-
-# install.py tool to do build of the linear algebra library
-# used to automate the steps described in the README file in this dir
-
-import sys,commands,os
-
-# help message
-
-help = """
-Syntax from src dir: make lib-linalg args="-m machine"
-Syntax from lib dir: python Install.py -m machine
-
-  -m = peform a clean followed by "make -f Makefile.machine"
-       machine = suffix of a lib/Makefile.* file
-
-Example:
-
-make lib-linalg args="-m gfortran"   # build with GNU Fortran compiler
-"""
-
-# print error message or help
-
-def error(str=None):
-  if not str: print help
-  else: print "ERROR",str
-  sys.exit()
-
-# parse args
-
-args = sys.argv[1:]
-nargs = len(args)
-if nargs == 0: error()
-
-machine = None
-
-iarg = 0
-while iarg < nargs:
-  if args[iarg] == "-m":
-    if iarg+2 > nargs: error()
-    machine = args[iarg+1]
-    iarg += 2  
-  else: error()
-
-# set lib from working dir
-
-cwd = os.getcwd()
-lib = os.path.basename(cwd)
-
-# make the library
-
-print "Building lib%s.a ..." % lib
-cmd = "make -f Makefile.%s clean; make -f Makefile.%s" % (machine,machine)
-txt = commands.getoutput(cmd)
-print txt
-
-if os.path.exists("lib%s.a" % lib): print "Build was successful"
-else: error("Build of lib/%s/lib%s.a was NOT successful" % (lib,lib))
diff --git a/lib/linalg/Makefile.gfortran b/lib/linalg/Makefile.gfortran
index 89b7f2d7a0..7e1d97a5bc 100644
--- a/lib/linalg/Makefile.gfortran
+++ b/lib/linalg/Makefile.gfortran
@@ -18,10 +18,8 @@ OBJ =   $(SRC:.f=.o)
 # ------ SETTINGS ------
 
 FC =           gfortran
-FFLAGS =      -O3 -fPIC -march=native -mpc64  \
-         -ffast-math -funroll-loops -fstrict-aliasing -Wall -W -Wno-uninitialized -fno-second-underscore
-FFLAGS0 =      -O0 -fPIC -march=native -mpc64  \
-         -Wall -W -Wno-uninitialized -fno-second-underscore
+FFLAGS =      -O3 -fPIC -ffast-math -fstrict-aliasing -fno-second-underscore
+FFLAGS0 =     -O0 -fPIC -fno-second-underscore
 ARCHIVE =	ar
 AR =	ar
 ARCHFLAG =	-rcs
@@ -47,7 +45,7 @@ dlamch.o: dlamch.f
 # ------ CLEAN ------
 
 clean:
-	-rm *.o *.mod *~ $(LIB)
+	-rm -f *.o *.mod *~ $(LIB)
 
 tar:
 	-tar -czvf ../linalg.tar.gz $(FILES)
diff --git a/lib/linalg/Makefile.mingw32-cross b/lib/linalg/Makefile.mingw32-cross
deleted file mode 100644
index 02aa3f71a3..0000000000
--- a/lib/linalg/Makefile.mingw32-cross
+++ /dev/null
@@ -1,67 +0,0 @@
-# -*- makefile -*-
-# *_________________________________________________________________________*
-# *      Minimal BLAS/LAPACK Library for use by other LAMMPS packages
-
-SHELL = /bin/sh
-
-# ------ FILES ------
-
-SRC =	$(wildcard *.f)
-
-FILES = $(SRC) Makefile.* README
-
-# ------ DEFINITIONS ------
-
-DIR = Obj_mingw32/
-LIB = $(DIR)liblinalg.a
-OBJ =   $(SRC:%.f=$(DIR)%.o)
-
-# ------ SETTINGS ------
-
-FC =    	i686-w64-mingw32-gfortran
-FFLAGS =	-O3 -march=i686 -mtune=generic -mfpmath=387 -mpc64	\
-		-ffast-math -funroll-loops -fstrict-aliasing -Wall -W	\
-		-Wno-uninitialized -fno-second-underscore
-FFLAGS0 =	-O0 -march=i686 -mtune=generic -mfpmath=387 -mpc64	\
-		-Wall -W -Wno-uninitialized -fno-second-underscore
-ARCHIVE =	i686-w64-mingw32-ar
-AR =		i686-w64-mingw32-ar
-ARCHFLAG =	-rcs
-USRLIB =
-SYSLIB =
-
-.PHONY: default clean tar
-
-.SUFFIXES:
-.SUFFIXES: .F .f .o
-
-# ------ MAKE PROCEDURE ------
-
-default: $(DIR) $(LIB)
-
-$(LIB): $(OBJ)
-	$(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ)
-
-$(DIR):
-	mkdir $(DIR)
-
-# ------ COMPILE RULES ------
-
-$(DIR)%.o:%.F
-	$(F90) $(F90FLAGS) -c $< -o $@
-
-$(DIR)%.o:%.f
-	$(FC) $(FFLAGS) -c $< -o $@
-
-$(DIR)dlamch.o: dlamch.f
-	$(FC) $(FFLAGS0) -c $< -o $@
-
-# ------ CLEAN ------
-
-clean:
-	-rm $(DIR)*.o $(DIR)*.mod *~ $(LIB)
-	-rmdir $(DIR)
-
-tar:
-	-tar -czvf ../linalg.tar.gz $(FILES)
-
diff --git a/lib/linalg/Makefile.mingw32-cross-mpi b/lib/linalg/Makefile.mingw32-cross-mpi
deleted file mode 100644
index 1e35c5b461..0000000000
--- a/lib/linalg/Makefile.mingw32-cross-mpi
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- makefile -*- wrapper for non-MPI libraries
-
-SHELL=/bin/sh
-
-all:
-	$(MAKE) $(MFLAGS) mingw32-cross
-	-rm -f Obj_mingw32-mpi
-	ln -s Obj_mingw32 Obj_mingw32-mpi
-
-clean:
-	$(MAKE) $(MFLAGS) clean-mingw32-cross
-	-rm -f Obj_mingw32-mpi
-
diff --git a/lib/linalg/Makefile.mingw64-cross b/lib/linalg/Makefile.mingw64-cross
deleted file mode 100644
index ee6eef819b..0000000000
--- a/lib/linalg/Makefile.mingw64-cross
+++ /dev/null
@@ -1,67 +0,0 @@
-# -*- makefile -*-
-# *_________________________________________________________________________*
-# *      Minimal BLAS/LAPACK Library for use by other LAMMPS packages
-
-SHELL = /bin/sh
-
-# ------ FILES ------
-
-SRC =	$(wildcard *.f)
-
-FILES = $(SRC) Makefile.* README
-
-# ------ DEFINITIONS ------
-
-DIR = Obj_mingw64/
-LIB = $(DIR)liblinalg.a
-OBJ =   $(SRC:%.f=$(DIR)%.o)
-
-# ------ SETTINGS ------
-
-FC =    	x86_64-w64-mingw32-gfortran
-FFLAGS =	-O3 -march=core2 -mtune=generic -msse2 -mpc64	\
-		-ffast-math -funroll-loops -fstrict-aliasing -Wall -W	\
-		-Wno-uninitialized -fno-second-underscore
-FFLAGS0 =	-O0 -march=core2 -mtune=generic -msse2 -mpc64	\
-		-Wall -W -Wno-uninitialized -fno-second-underscore
-ARCHIVE =	x86_64-w64-mingw32-ar
-AR =		x86_64-w64-mingw32-ar
-ARCHFLAG =	-rcs
-USRLIB =
-SYSLIB =
-
-.PHONY: default clean tar
-
-.SUFFIXES:
-.SUFFIXES: .F .f .o
-
-# ------ MAKE PROCEDURE ------
-
-default: $(DIR) $(LIB)
-
-$(LIB): $(OBJ)
-	$(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ)
-
-$(DIR):
-	mkdir $(DIR)
-
-# ------ COMPILE RULES ------
-
-$(DIR)%.o:%.F
-	$(F90) $(F90FLAGS) -c $< -o $@
-
-$(DIR)%.o:%.f
-	$(FC) $(FFLAGS) -c $< -o $@
-
-$(DIR)dlamch.o: dlamch.f
-	$(FC) $(FFLAGS0) -c $< -o $@
-
-# ------ CLEAN ------
-
-clean:
-	-rm $(DIR)*.o $(DIR)*.mod *~ $(LIB)
-	-rmdir $(DIR)
-
-tar:
-	-tar -czvf ../linalg.tar.gz $(FILES)
-
diff --git a/lib/linalg/Makefile.mingw64-cross-mpi b/lib/linalg/Makefile.mingw64-cross-mpi
deleted file mode 100644
index ca6f4a6d43..0000000000
--- a/lib/linalg/Makefile.mingw64-cross-mpi
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- makefile -*- wrapper for non-MPI libraries
-
-SHELL=/bin/sh
-
-all:
-	$(MAKE) $(MFLAGS) mingw64-cross
-	-rm -f Obj_mingw64-mpi
-	ln -s Obj_mingw64 Obj_mingw64-mpi
-
-clean:
-	$(MAKE) $(MFLAGS) clean-mingw64-cross
-	-rm -f Obj_mingw64-mpi
-
diff --git a/lib/linalg/Makefile.serial b/lib/linalg/Makefile.serial
new file mode 120000
index 0000000000..c52fbcb986
--- /dev/null
+++ b/lib/linalg/Makefile.serial
@@ -0,0 +1 @@
+Makefile.gfortran
\ No newline at end of file
-- 
GitLab