title: makefile module compiling gfortran in fortran 90
body: <p>I try to use the makefile to link up some modules to the main program.</p>
  
  <p>I have a module called SimParam_mod.f90 which has:</p>
  
  <pre><code>MODULE simParam
    integer, parameter:: yDim = 80
    integer, parameter:: xDim = 80
  
    integer, parameter:: iterper = 100
    integer, parameter:: tMax = 2000
  END MODULE simParam
  </code></pre>
  
  <p>After compiling it using the make option: </p>
  
  <pre><code>MODDIR =../module 
  CFLAGS=-I$(IDIR)
  OBJDIR=obj
  LIBDIR =../lib
  
  LIBS=-lm
  
  CF=gfortran
  CFLAGS=-I.
  
  OBJ = main.o D2Q9Const_mod.o SimParam_mod.o 
  
  
  %.o: %.f90
          $(CF) -c -O3 -o $@ $&lt; -I$(MODDIR)
  
  run: $(OBJ)
      $(CF) -o $@ $^ $(CFLAGS)
  </code></pre>
  
  <p>the values stored for <strong>iterper</strong> and <strong>tMax</strong> are not updated. I save it correctly and the modules compiled with gfortran -c  don't see any problem and the create the .mod files.</p>
  
  <p>I checked the .mod files and they store it with values which are not the ones specified in the module.f90, iterper = 1 and tMax = 20 and should be 100 and 2000 respectively. All what I can say is that I don't know really how to use the make instructions and that these wrong values that get stored are former values that I had defined much earlier.. there is something that I miss..</p>
  
  <p>Thanks in advance for your help!</p>
  
  <p>Puigar</p>