# -*- makefile -*-
# *_________________________________________________________________________*
# *      Minimal BLAS/LAPACK Library for use by other LAMMPS packages

SHELL = /bin/sh

# ------ FILES ------

SRC =	$(wildcard *.f)

FILES = $(SRC) Makefile.* README

# ------ DEFINITIONS ------

LIB = liblinalg.a
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
ARCHIVE =	ar
AR =	ar
ARCHFLAG =	-rcs
USRLIB =
SYSLIB =

# ------ MAKE PROCEDURE ------

lib: 	$(OBJ)
	$(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ)

# ------ COMPILE RULES ------

%.o:%.F
	$(F90) $(F90FLAGS) -c $<

%.o:%.f
	$(FC) $(FFLAGS) -c $<

dlamch.o: dlamch.f
	$(FC) $(FFLAGS0) -c $<

# ------ CLEAN ------

clean:
	-rm *.o *.mod *~ $(LIB)

tar:
	-tar -czvf ../linalg.tar.gz $(FILES)

