They should probably be installed in this order. On linux distributions such as Ubuntu, they may be available as packages.
These do not have to be installed separately.
When all dependencies are satisfied, the program is then compiled in the standard way:
1##############################################################################
2#
3# Example makefile for the program PB3D (Peeling Ballooning in 3D)
4# \author Author: Toon Weyens
5#
6# Don't forget to set the directories:
7# - LIBSTELL_DIR
8# - HDF5_DIR
9# - NETCDFF_DIR (note: Fortran library)
10# - PETSC_DIR
11# - SLEPC_DIR
12# - STRUMPACK_DIR
13##############################################################################
14
15##############################################################################
16# Include
17##############################################################################
18## [PETSc and SLEPc trick]
19include $(PETSC_DIR)/lib/petsc/conf/variables
20include $(SLEPC_DIR)/lib/slepc/conf/slepc_variables
21## [PETSc and SLEPc trick]
22
23## [PETSc and SLEPc trick inc]
24INCLUDE = $(PETSC_FC_INCLUDES) $(SLEPC_INCLUDE)
25## [PETSc and SLEPc trick inc]
26## [Libstell special]
27INCLUDE += -I$(LIBSTELL_DIR)/libstell_dir
28## [Libstell special]
29INCLUDE += -I$(STRUMPACK_DIR)/include
30## [PB3D include]
31INCLUDE += -I$(PB3D_DIR)/include
32## [PB3D include]
33INCLUDE += -I/usr/include/hdf5/openmpi
34
35##############################################################################
36# Link
37##############################################################################
38## [PB3D libraries]
39LIB_INTERNAL = libdfftpack.a libfoul.a libbspline.a
40## [PB3D libraries]
41
42LINK := $(LIB_INTERNAL)
43
44## [PETSc and SLEPc trick lib]
45LINK += $(PETSC_LIB)
46LINK += $(SLEPC_LIB)
47## [PETSc and SLEPc trick lib]
48LINK += $(LIBSTELL_DIR)/libstell.a
49LINK += -L$(STRUMPACK_DIR)/lib -lstrumpack
50LINK += -L$(HDF5_DIR) -lhdf5_fortran -lhdf5
51LINK += -L$(NETCDFF_DIR)/lib -lnetcdff
52LINK += -Wl,-R$(NETCDFF_DIR)/lib
53LINK += -lscalapack -lblacs -lblas -lm
54LINK += -lstdc++ -lmpi_cxx
55
56
57##############################################################################
58# Compiler
59##############################################################################
60COMPILER=mpifort
61
62
63##############################################################################
64# Linker
65##############################################################################
66LINKER=mpifort
67
68
69##############################################################################
70# Compiler flags
71# options (used with -D[name]):
72# ldebug: debug
73# lIB: infiniband
74# lwith_gnu: use GNU compiler [default]
75# lwith_intel: use INTEL compiler, (checked for version 12.0.2)
76# note: INTEL warning 6536 is suppressed, which informs about extra "USE".
77# note: INTEL warning 6843 is suppressed, which informs about empty
78# intent(out) variables
79##############################################################################
80COMP_FLAGS = -finit-real=snan -g -Og -Wall -Wextra -pedantic \
81 -fimplicit-none -fbacktrace -fno-omit-frame-pointer \
82 -fcheck=all -cpp -Dldebug# debug, profiling with gprof2dot, GCC
83#COMP_FLAGS = -O3 -fbacktrace -g -fimplicit-none -fno-omit-frame-pointer \
84 #-cpp# optimized, GCC
85
86#COMP_FLAGS = -O0 -DlIB -Dldebug -g -heap-arrays 100 -recursive \
87 #-ftrapuv -check bounds -check uninit -traceback -implicitnone \
88 #-fno-omit-frame-pointer -cpp -Dlwith_intel -diag-disable 6536 \
89 #-diag-disable 6843# debug, profiling with gprof2dot, INTEL
90#COMP_FLAGS = -O3 -DlIB -traceback -g -heap-arrays 100 -recursive \
91 #-implicitnone -fno-omit-frame-pointer -cpp -Dlwith_intel \
92 #-diag-disable 6536 -diag-disable 6843# optimized, INTEL
93
94COMP_FLAGS_EX= -O2 -w
95
96COMP_FLAGS_F= -O2 -funroll-loops -fexpensive-optimizations
97
98
99##############################################################################
100# Link flags
101##############################################################################
102LINK_FLAGS = -fPIC -finit-real=snan# debug
103#LINK_FLAGS = -fPIC# optimized
104
105
106##############################################################################
107# Prepare
108##############################################################################
109# Add "Modules" and "Libraries" to the search path for the prerequisites
110VPATH = Modules:Libraries
111
112# Contains list of source files (.o) and dependencies
113DEPLIST = PB3D.dep
114OBJLIST = ObjectList# defines "ObjectFiles"
115
116# Includes source files and dependency list
117include $(DEPLIST)# Dependencies of all the objects
118include $(OBJLIST)# Names of all the objects
119
120
121##############################################################################
122# Rules
123##############################################################################
124all: PB3D POST
125
126PB3D: $(ObjectFiles) $(LIB_INTERNAL) PB3D.o
127 $(LINKER) -o $@ $(ObjectFiles) PB3D.o $(LINK) $(LINK_FLAGS)
128
129POST: $(ObjectFiles) $(LIB_INTERNAL) POST.o
130 $(LINKER) -o $@ $(ObjectFiles) POST.o $(LINK) $(LINK_FLAGS)
131
132libdfftpack.a: dfft.o
133 ar -rcs libdfftpack.a dfft.o
134
135libfoul.a: foul.o
136 ar -rcs libfoul.a foul.o
137
138libbspline.a: bspline_sub_module.o
139 ar -rcs libbspline.a bspline_sub_module.o
140
141%.o: %.f90
142 $(COMPILER) $(INCLUDE) $(COMP_FLAGS) -c $<
143
144%.o: %.f
145 $(COMPILER) $(COMP_FLAGS_F) -c $<
146
147dfft.o: dfft.f
148 $(COMPILER) $(COMP_FLAGS_EX) -c $<
149
150foul.o: foul.f90
151 $(COMPILER) $(COMP_FLAGS_EX) -c $<
152
153bspline_sub_module.o: bspline_sub_module.f90
154 $(COMPILER) $(COMP_FLAGS_EX) -c $<
155
156clean:
157 @rm -f *.o *.a *.mod *~ fort.*
158
159clean_all:
160 @rm -f *.o *.mod *~ fort.* PB3D POST