TABLE OF CONTENTS


CGPACK/Makefile-bc3-ifort-shared [ Make files ]

[ Top ] [ Make files ]

NAME

Makefile-bc3-ifort-shared

SYNOPSIS

#$Id: Makefile-bc3-ifort-shared 382 2017-03-22 11:41:51Z mexas $

FC=             ifort

PURPOSE

Build/install CGPACK on the University of Bristol BlueCrystal computer with Intel Fortran compiler.

DESCRIPTION

This makefile is to build CGPACK with ifort for shared memory!

AUTHOR

Anton Shterenlikht

COPYRIGHT

See LICENSE

SOURCE

FFLAGS=         -c -assume realloc_lhs -coarray=shared \
                -traceback \
                -free -fPIC -warn all -O2 -qopt-report #-std08 #-warn stderrors
#               -coarray-config-file=xx14.conf -debug full \

CGPACK=         cgpack
MYLIB=          lib$(CGPACK).a
LIBDIR=         $(HOME)/lib
MODDIR=         $(HOME)/mod

# level 1

L1_SRC=         cgca_m1co.f90
L1_MOD=         $(L1_SRC:.f90=.mod)
L1_OBJ=         $(L1_SRC:.f90=.o)

# level 2 modules and submodules

L2_SRC_MOD=     cgca_m2alloc.f90 cgca_m2gb.f90 cgca_m2geom.f90 \
                cgca_m2glm.f90 cgca_m2hx.f90 cgca_m2lnklst.f90 \
                cgca_m2out.f90 cgca_m2pck.f90 \
                cgca_m2phys.f90 cgca_m2red.f90 cgca_m2rnd.f90 \
                cgca_m2rot.f90 cgca_m2stat.f90
L2_SRC_SUBMOD=  # m2out_sm1.f90 - Cray only
                # m2out_sm2_mpi.f90 - MPI only
L2_SRC=         $(L2_SRC_MOD) $(L2_SRC_SUBMOD)
L2_OBJ=         $(L2_SRC:.f90=.o)
L2_MOD=         $(L2_SRC_MOD:.f90=.mod)
L2_SUBMOD=      # cgca_m2out@m2out_sm1.smod - Cray only
                # cgca_m2out@m2out_sm2_mpi.smod - MPI only

# level 3 modules and submodules

L3_SRC_MOD=     cgca_m3clvg.f90 cgca_m3gbf.f90 cgca_m3nucl.f90 \
                cgca_m3pfem.f90 cgca_m3sld.f90
L3_SRC_SUBMOD=  m3clvg_sm1.f90 m3clvg_sm2.f90 m3sld_sm1.f90
                # m3clvg_sm3.f90 - uses collectives, not for ifort 16.0.0
                # m3pfem_sm1.f90 - uses collectives, not for ifort 16.0.0
L3_SRC=         $(L3_SRC_MOD) $(L3_SRC_SUBMOD)
L3_OBJ=         $(L3_SRC:.f90=.o)
L3_MOD=         $(L3_SRC_MOD:.f90=.mod)
L3_SUBMOD=      cgca_m3clvg@m3clvg_sm1.smod \
                cgca_m3clvg@m3clvg_sm2.smod \
                cgca_m3sld@m3sld_sm1.smod
                # cgca_m3clvg@m3clvg_sm3.smod

# level 4

L4_SRC=         cgca_m4fr.f90
L4_MOD=         $(L4_SRC:.f90=.mod)
L4_OBJ=         $(L4_SRC:.f90=.o)

# top level

LTOP_SRC=       cgca.f90
LTOP_MOD=       $(LTOP_SRC:.f90=.mod)
LTOP_OBJ=       $(LTOP_SRC:.f90=.o)

ALL_MOD=        $(L1_MOD) $(L2_MOD) $(L3_MOD) $(L4_MOD) $(LTOP_MOD)
ALL_SUBMOD=     $(L2_SUBMOD) $(L3_SUBMOD)
ALL_OBJ=        $(L1_OBJ) $(L2_OBJ) $(L3_OBJ) $(L4_OBJ) $(LTOP_OBJ)

ALL_CLEAN=      *.mod *.smod *.o *.optrpt $(MYLIB)

.SUFFIXES:
.SUFFIXES: .f90 .mod .o

all: $(MYLIB)

.f90.mod:
        $(FC) $(FFLAGS) $<

.f90.o:
        $(FC) $(FFLAGS) $<

# module dependencies

$(L2_MOD) $(L2_OBJ): $(L1_MOD)
$(L3_MOD) $(L3_OBJ): $(L2_MOD) $(L2_SUBMOD)
$(L4_MOD) $(L4_OBJ): $(L3_MOD) $(L3_SUBMOD)
$(LTOP_MOD) $(LTOP_OBJ): $(L4_MOD)
$(MYLIB): $(MOD_LTOP) $(OBJ_LTOP)

# Submodule dependencies
# level 2
m2out_sm1.o: cgca_m2out.mod cgca_m2out.o 
# level 3
m3clvg_sm1.o m3clvg_sm2.o: cgca_m3clvg.mod cgca_m3clvg.o
m3sld_sm1.o: cgca_m3sld.mod cgca_m3sld.o

$(MYLIB): $(ALL_OBJ)
        @if [ -e $(MYLIB) ]; then \
                rm $(MYLIB); \
        fi
        ar -r $(MYLIB) $(ALL_OBJ)

install: $(MYLIB) $(ALL_MOD) $(ALL_SUBMOD)
        @if [ -e $(LIBDIR)/$(MYLIB) ]; then \
                echo $(LIBDIR)/$(MYLIB) already exists; \
                echo run \"make deinstall\" first; \
                exit 1; \
        fi
        cp $(MYLIB) $(LIBDIR)
        cp $(ALL_MOD) $(ALL_SUBMOD) $(MODDIR)

deinstall:
        cd $(LIBDIR) && rm $(MYLIB)
        cd $(MODDIR) && rm $(ALL_MOD) $(ALL_SUBMOD)

clean:
        rm $(ALL_CLEAN)