如何自定义makefile文件以编译BLACS库

时间:2019-09-26 18:50:59

标签: fortran scalapack

我有一个makefile文件,可以在Fortran中编译我的代码。 该makefile也已经编译了Lapack库。 鉴于我已经在系统中安装了BLACS库,如何修改此makefile以便也编译BLACS库。

我的制作文件:

#$preamble
# A simple hand-made makefile for a package including applications
# built from Fortran 90 sources, taking into account the usual
# dependency cases.

# This makefile works with the GNU make command, the one find on
# GNU/Linux systems and often called gmake on non-GNU systems, if you
# are using an old style make command, please see the file
# Makefile_oldstyle provided with the package.

# ======================================================================
# Let's start with the declarations
# ======================================================================

# The compiler
FC = gfortran
# flags for debugging or for maximum performance, comment as necessary
FCFLAGS = -g -fbounds-check
FCFLAGS = -O3 -ffixed-line-length-0 -ffree-line-length-0 
LDFLAGS = -llapack -lblas
#flags forall (e.g. look for system .mod files, required in gfortran)
FCFLAGS += -I/usr/include

# libraries needed for linking, unused in the examples
#LDFLAGS = -li_need_this_lib

# List of executables to be built within the package
PROGRAMS = exe

# "make" builds all
all: $(PROGRAMS)

# General rule for building prog from prog.o; $^ (GNU extension) is
# used in order to list additional object files on which the
# executable depends
%: %.o
    $(FC) $(FCFLAGS) -o $@ $^ $(LDFLAGS)

# General rules for building prog.o from prog.f90 or prog.F90; $< is
# used in order to list only the first prerequisite (the source file)
# and not the additional prerequisites such as module or include files
%.o: %.f90
    $(FC) $(FCFLAGS) -c $<

%.o: %.F90
    $(FC) $(FCFLAGS) -c $<

# Utility targets
.PHONY: clean veryclean

clean:
    rm -f *.o *.mod *.MOD exe

veryclean: clean
    rm -f *~ $(PROGRAMS)

0 个答案:

没有答案