Page MenuHomec4science

Makefile
No OneTemporary

File Metadata

Created
Wed, Dec 18, 05:26

Makefile

#
# @file Makefile
#
# @brief
#
# @copyright
# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
# SPC (Swiss Plasma Center)
#
# spclibs is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# spclibs is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# @authors
# (in alphabetical order)
# @author Stephan Brunner <stephan.brunner@epfl.ch>
# @author Sébastien Jolliet <sebastien.jolliet@epfl.ch>
# @author Trach-Minh Tran <trach-minh.tran@epfl.ch>
#
PREFIX=/usr/local/crpp
FUTILS=$(PREFIX)/futils
PPPACK=../pppack
PPUTILS2=../pputils2
MPIF90 = mpif90
F90 = mpif90
LD = $(MPIF90)
debug = -g -traceback -check bounds -fpe0 -warn alignments -warn unused
debug = -g -traceback -check bounds -fpe0 -warn alignments
optim = -O3 -xHOST
#OPT=$(debug)
OPT=$(optim)
F90FLAGS = $(OPT) -fPIC -I. -I$(FUTILS)/include
CC = cc
CFLAGS = -O2
SPL_OBJS = bsplines.o matrix.o sparse_mod.o pardiso_mod.o \
lapack_extra.o conmat.o math_util.o
ifdef MKL
SPBLAS = -DMKL
endif
ifdef MUMPS
SPL_OBJS += mumps_mod.o csr_mod.o cds_mod.o multigrid_mod.o
F90FLAGS += -I$(MUMPS)/include
endif
ifdef WSMP
SPL_OBJS += wsmp_mod.o pwsmp_mod.o
endif
ifdef PETSC_DIR
SPL_OBJS += petsc_mod.o
FCCPFLAGS = -I$(PETSC_DIR)/include -I$(PETSC_DIR)/$(PETSC_ARCH)/include
endif
.SUFFIXES:
.SUFFIXES: .o .c .f90 .f .F90
.f90.o:
$(MPIF90) $(F90FLAGS) -c $<
.F90.o:
$(MPIF90) $(F90FLAGS) $(FCCPFLAGS) -c $<
.f.o:
$(F90) $(F90FLAGS) -c $<
SUBDIRS = pputils2 pppack fft
subdirs: $(SUBDIRS)
.PHONY: subdirs $(SUBSDIRS) $(PPUTILS2)
$(SUBDIRS):
$(MAKE) "OPT=$(OPT)" -C ../$@ lib
lib: subdirs libbsplines.a
cp -p $(PPPACK)/libpppack.a ./
touch lib
cp -p lib ../examples
libbsplines.a: $(SPL_OBJS)
xiar r $@ $?
ranlib $@
debug:
make clean
make "OPT=$(debug)" lib
mkdir -p .g
cp -p libbsplines.a $(PPPACK)/libpppack.a *.mod .g/
opt:
make clean
make "OPT=$(optim)" lib
mkdir -p $(PREFIX)/{lib,include}/O
mkdir -p .O
cp -p libbsplines.a $(PPPACK)/libpppack.a *.mod .O/
install: debug opt
mkdir -p $(PREFIX)/{lib,include}/g
mv .g/*.a $(PREFIX)/lib/g/
mv .g/*.mod $(PREFIX)/include/g/
mkdir -p $(PREFIX)/{lib,include}/O
mv .O/*.a $(PREFIX)/lib/O/
mv .O/*.mod $(PREFIX)/include/O/
uninstall:
rm -f $(PREFIX)/include/{O,g}/bsplines.mod \
$(PREFIX)/include/{O,g}/cds.mod \
$(PREFIX)/include/{O,g}/conmat_mod.mod \
$(PREFIX)/include/{O,g}/csr.mod \
$(PREFIX)/include/{O,g}/math_util.mod \
$(PREFIX)/include/{O,g}/matrix.mod \
$(PREFIX)/include/{O,g}/multigrid.mod \
$(PREFIX)/include/{O,g}/mumps_bsplines.mod \
$(PREFIX)/include/{O,g}/pardiso_bsplines.mod \
$(PREFIX)/include/{O,g}/petsc_bsplines.mod \
$(PREFIX)/include/{O,g}/sparse.mod \
$(PREFIX)/include/{O,g}/wsmp_bsplines.mod \
$(PREFIX)/lib/{O,g}/libbsplines.a \
$(PREFIX)/lib/{O,g}/libpppack.a
matrix.o: matrix.f90
sparse_mod.o: sparse_mod.f90
bsplines.o: bsplines.f90 matrix.o
multigrid_mod.o: bsplines.o matrix.o conmat.o csr_mod.o cds_mod.o
conmat.o: conmat.f90 conmat.tpl conmat_1d.tpl zconmat.tpl zconmat_1d.tpl conrhs.tpl
$(F90) -fpp -DMKL -DWSMP -DMUMPS $(F90FLAGS) -c conmat.f90
cds_mod.o: cds_mod.f90
$(F90) -fpp $(SPBLAS) $(F90FLAGS) -c cds_mod.f90
pardiso_mod.o: pardiso_mod.f90 sparse_mod.o psum_mat.tpl p2p_mat.tpl
$(F90) -fpp $(SPBLAS) $(F90FLAGS) -c pardiso_mod.f90
mumps_mod.o:mumps_mod.f90 sparse_mod.o psum_mat.tpl p2p_mat.tpl
$(F90) -fpp $(SPBLAS) $(F90FLAGS) -I$(PPUTILS2) -c mumps_mod.f90
wsmp_mod.o: wsmp_mod.f90 sparse_mod.o psum_mat.tpl p2p_mat.tpl
$(F90) -fpp $(SPBLAS) $(F90FLAGS) -I$(PPUTILS2) -c wsmp_mod.f90
pwsmp_mod.o: pwsmp_mod.f90 sparse_mod.o wsmp_mod.o psum_mat.tpl p2p_mat.tpl
$(F90) -fpp $(SPBLAS) $(F90FLAGS) -I$(PPUTILS2) -c pwsmp_mod.f90
petsc_mod.o: petsc_mod.F90 sparse_mod.o
$(F90) -fpp $(FCCPFLAGS) $(SPBLAS) $(F90FLAGS) -I$(PPUTILS2) -c petsc_mod.F90
csr_mod.o: csr_mod.f90 sparse_mod.o mumps_mod.o
$(F90) -fpp $(SPBLAS) $(F90FLAGS) -I$(PPUTILS2) -c csr_mod.f90
tags:
etags *.f *.f90 $(PPPACK)/*.f90
clean:
$(MAKE) -C $(PPPACK) clean
$(MAKE) -C ../fft clean
rm -f *.o *.mod *~ a.out
distclean: clean
$(MAKE) -C $(PPPACK) distclean
$(MAKE) -C ../fft distclean
$(MAKE) -C $(PPUTILS2) distclean
rm -f lib *.a *.mod ../bin/*
rm -rf .O .g

Event Timeline