title: Adding LAPACK libraries in Fortran Make file
body: <p>I am writing a code in Fortran90. I require to use dgesv function from LAPACK libraries. I have several subroutines that I am compiling with gfortran using a <code>make file</code>. I can link the Lapack libraries with gfortran by using </p>
  
  <pre><code>gfortran test.f -L/path/to/libs -llapack -lblas
  </code></pre>
  
  <p>Can anyone help in how to add these libraries to my make file? My make file is below:</p>
  
  <pre><code>.SUFFIXES:
  .SUFFIXES: .f .o .f90
  #
  LIBDIR = lib
  UNAME := $(shell uname)
  
  DEFINE = 
  FCOMP  = gfortran
  FOPTS  = -fdefault-real-8 -g -fbounds-check -fbacktrace -O2 -Wline-truncation
  F90OPTS = -ffree-form -ffree-line-length-none
  #FOPTS = -fPIC -g
  
  OBJS =  read_model_2d_elasto.o output_2d_elasto.o 2d_elastostatics_FEM.o stiffness_2d_elasto.o stress_strain_2d_elasto.o \
  
  XLIBS  = -L/usr/X11R6/lib64 -lX11 -lpthread 
  GLIBS  = -L/usr/X11R6/lib64 -lGLU -lGL -lX11 -lXext -lpthread
  
  #default:   2d_elastostatics_FEM techop
  all: 2d_elastostatics_FEM 
  
  ifeq ($(UNAME),Darwin)
    2d_elastostatics_FEM:$(OBJS)
      $(FCOMP)  -g $(OBJS) -o 2d_elastostatics_FEM 
  else
    2d_elastostatics_FEM:$(OBJS)
      $(FCOMP)  -g -static $(OBJS) -o 2d_elastostatics_FEM
  endif
  
  .f.o:; $(FCOMP) -c -o $@ $(FOPTS) $*.f
  .f90.o:; $(FCOMP) -c -o $@ $(FOPTS) $(F90OPTS) $*.f90
  
  clean:
  
      -rm -f 2d_elastostatics_FEM $(OBJS) *.mod *.x *.exe
  </code></pre>