Page MenuHomec4science

Makefile
No OneTemporary

File Metadata

Created
Wed, Nov 27, 13:15

Makefile

PREFIX=$(SPC_LOCAL)
PPPACK=../pppack
PPUTILS2=../pputils2
MPIF90 = $(SPC_MPIF90)
F90 = $(MPIF90)
LD = $(MPIF90)
OPTLEVEL = O
ifeq ($(OPTLEVEL), O) #optimized
ifeq ($(COMPTYPE), i) #intel
OPT = -O3 -xHOST -fpp
endif
ifeq ($(COMPTYPE), g) #gnu
OPT = -ffree-line-length-0 -O3 -cpp
endif
ifeq ($(COMPTYPE), c) #cray
OPT = -e Z
endif
endif
ifeq ($(OPTLEVEL), g) #debug
ifeq ($(COMPTYPE), i) #intel
OPT = -g -traceback -CB -check bounds -fpe0 -warn alignments -fpp
endif
ifeq ($(COMPTYPE), g) #gnu
OPT = -ffree-line-length-0 -g -fbacktrace -fbounds-check -cpp
endif
ifeq ($(COMPTYPE), c) #cray
OPT = -g -O0 -e Z
endif
endif
F90FLAGS = $(OPT) -fPIC -I. -I$(PREFIX)/include/$(OPTLEVEL)
CC = $(SPC_MPICC)
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) "OPTLEVEL=$(OPTLEVEL)" "OPT=$(OPT)" -C ../$@ lib
lib: subdirs libbsplines.a
cp -p $(PPPACK)/libpppack.a ./
cp -p $(PPUTILS2)/libpputils2.a ./
touch lib
cp -p lib ../examples
libbsplines.a: $(SPL_OBJS)
ar r $@ $?
ranlib $@
debug:
make clean
make "OPTLEVEL=g" lib
mkdir -p .g
cp -p libbsplines.a $(PPPACK)/libpppack.a $(PPUTILS2)/libpputils2.a $(PPUTILS2)/*.mod *.mod .g/
opt:
make clean
make "OPTLEVEL=O" lib
mkdir -p $(PREFIX)/lib/O
mkdir -p $(PREFIX)/include/O
mkdir -p .O
cp -p libbsplines.a $(PPPACK)/libpppack.a $(PPUTILS2)/libpputils2.a $(PPUTILS2)/*.mod *.mod .O/
install: debug opt
mkdir -p $(PREFIX)/lib/g
mkdir -p $(PREFIX)/include/g
mv .g/*.a $(PREFIX)/lib/g/
mv .g/*.mod $(PREFIX)/include/g/
mkdir -p $(PREFIX)/lib/O
mkdir -p $(PREFIX)/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 \
$(PREFIX)/lib/{O,g}/libpputils2.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) -DMKL -DWSMP -DMUMPS $(F90FLAGS) -c conmat.f90
cds_mod.o: cds_mod.f90
$(F90) $(SPBLAS) $(F90FLAGS) -c cds_mod.f90
pardiso_mod.o: pardiso_mod.f90 sparse_mod.o psum_mat.tpl p2p_mat.tpl
$(F90) $(SPBLAS) $(F90FLAGS) -c pardiso_mod.f90
mumps_mod.o:mumps_mod.f90 sparse_mod.o psum_mat.tpl p2p_mat.tpl
$(F90) $(SPBLAS) $(F90FLAGS) -I$(PPUTILS2) -c mumps_mod.f90
wsmp_mod.o: wsmp_mod.f90 sparse_mod.o psum_mat.tpl p2p_mat.tpl
$(F90) $(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) $(SPBLAS) $(F90FLAGS) -I$(PPUTILS2) -c pwsmp_mod.f90
petsc_mod.o: petsc_mod.F90 sparse_mod.o
$(F90) $(FCCPFLAGS) $(SPBLAS) $(F90FLAGS) -I$(PPUTILS2) -c petsc_mod.F90
csr_mod.o: csr_mod.f90 sparse_mod.o mumps_mod.o
$(F90) $(SPBLAS) $(F90FLAGS) -I$(PPUTILS2) -c csr_mod.f90
tags:
etags *.f *.f90 $(PPPACK)/*.f90
clean:
$(MAKE) -C $(PPPACK) clean
$(MAKE) -C $(PPUTILS2) 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