<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <font face="serif">Bryan asked to see how my makefile to build the
      code with multiple targets was structured -- here it is...<br>
      <br>
    </font><tt># Makefile to build multiversioned babyBLAS&nbsp; </tt><tt><br>
    </tt><tt>#</tt><tt><br>
    </tt><tt># Andrew J. Pounds, Ph.D.</tt><tt><br>
    </tt><tt># Departments of Chemistry and Computer Science</tt><tt><br>
    </tt><tt># Mercer University</tt><tt><br>
    </tt><tt># Fall 2011 </tt><tt><br>
    </tt><tt>#</tt><tt><br>
    </tt><tt><br>
    </tt><tt>F95 = gfortran</tt><tt><br>
    </tt><tt>CC = gcc</tt><tt><br>
    </tt><tt>FFLAGS = -O2 -frepack-arrays -finline-functions&nbsp; -Wall</tt><tt><br>
    </tt><tt>CFLAGS = -Wall</tt><tt><br>
    </tt><tt>OLDFORMAT = -fixed-form</tt><tt><br>
    </tt><tt>LIBFLAG =</tt><tt><br>
    </tt><tt>GCCOPT = -param l2-cache-size=2048</tt><tt><br>
    </tt><tt>ATLAS = /usr/local/ATLAS/lib/libf77blas.a
      /usr/local/ATLAS/lib/libcblas.a /usr/local/ATLAS/lib/libatlas.a</tt><tt><br>
    </tt><tt><br>
    </tt><tt><br>
    </tt><tt>debug ?= n</tt><tt><br>
    </tt><tt>ifeq ($(debug), y)</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; CFLAGS += -g -DDEBUG</tt><tt><br>
    </tt><tt>else</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; CFLAGS += -O3 -mtune=native -march=native&nbsp; -ffast-math
      -fprefetch-loop-arrays \</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -ftree-vectorize -ftree-vectorizer-verbose=7</tt><tt><br>
    </tt><tt>endif</tt><tt><br>
    </tt><tt><br>
    </tt><tt>openmp ?= n</tt><tt><br>
    </tt><tt>ifeq ($(openmp), y)</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; CFLAGS += -fopenmp -DOPENMP</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; LIBFLAG += -lgomp</tt><tt><br>
    </tt><tt>endif</tt><tt><br>
    </tt><tt><br>
    </tt><tt>pthreads ?= n</tt><tt><br>
    </tt><tt>ifeq ($(pthreads), y)</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; CFLAGS += -pthread -DPTHREADS</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; LIBFLAG += -lpthread</tt><tt><br>
    </tt><tt>endif</tt><tt><br>
    </tt><tt><br>
    </tt><tt>OBJS = array.o zeromat.o walltime.o cputime.o mmm.o&nbsp; \</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vvm.o dot.o</tt><tt><br>
    </tt><tt><br>
    </tt><tt>all: mdriver accuracytest</tt><tt><br>
    </tt><tt><br>
    </tt><tt>mdriver : mdriver.o $(OBJS)</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; $(F95) -o mdriver mdriver.o $(OBJS) $(LIBFLAG)
      #$(ATLAS) </tt><tt><br>
    </tt><tt><br>
    </tt><tt>mdriver.o : mdriver.f90 array.o</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; $(F95) $(FFLAGS) -c mdriver.f90&nbsp; </tt><tt><br>
    </tt><tt><br>
    </tt><tt>accuracytest : accuracytest.o $(OBJS)</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; $(F95) -o accuracytest accuracytest.o $(OBJS)
      $(LIBFLAG) #$(ATLAS) </tt><tt><br>
    </tt><tt><br>
    </tt><tt>accuracytest.o : accuracytest.f90 array.o</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; $(F95) $(FFLAGS) -c accuracytest.f90&nbsp; </tt><tt><br>
    </tt><tt><br>
    </tt><tt>walltime.o : walltime.c</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; $(CC) $(CFLAGS) -c walltime.c</tt><tt><br>
    </tt><tt><br>
    </tt><tt>cputime.o : cputime.c</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; $(CC) $(CFLAGS) -c cputime.c</tt><tt><br>
    </tt><tt><br>
    </tt><tt>zeromat.o : zeromat.f90</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; $(F95) $(FFLAGS)&nbsp; -c zeromat.f90&nbsp; </tt><tt><br>
    </tt><tt><br>
    </tt><tt>array.o : array.f90</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; $(F95) -c array.f90</tt><tt><br>
    </tt><tt><br>
    </tt><tt>mmm.o : mmm.c</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; $(CC) $(CFLAGS)&nbsp; -c mmm.c</tt><tt><br>
    </tt><tt><br>
    </tt><tt>dot.o : dot.c</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; $(CC) $(CFLAGS) -c dot.c</tt><tt><br>
    </tt><tt><br>
    </tt><tt>vvm.o : vvm.c</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; $(CC) $(CFLAGS) -c vvm.c</tt><tt><br>
    </tt><tt><br>
    </tt><tt># Default Targets for Cleaning up the Environment</tt><tt><br>
    </tt><tt>clean :</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; rm *.o</tt><tt><br>
    </tt><tt><br>
    </tt><tt>pristine :</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; rm *.o</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; touch *.cc *.c *.f *.f90 </tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; rm *.mod</tt><tt><br>
    </tt><tt><br>
    </tt><tt>ctags :</tt><tt><br>
    </tt><tt>&nbsp;&nbsp;&nbsp; ctags *.f90</tt><font face="serif"><br>
      <br>
    </font>
    <pre class="moz-signature" cols="72">-- 
Andrew J. Pounds, Ph.D.  (<a class="moz-txt-link-abbreviated" href="mailto:pounds_aj@mercer.edu">pounds_aj@mercer.edu</a>)
Professor of Chemistry and Computer Science
Mercer University,  Macon, GA 31207   (478) 301-5627
<a class="moz-txt-link-freetext" href="http://faculty.mercer.edu/pounds_aj">http://faculty.mercer.edu/pounds_aj</a>
</pre>
  </body>
</html>