Subsections
Main Makefile fhp.mk
You already know how to invoke the main Makefile fhp.mk (see
section 3.5.1). Now let us have a more detailed look into
the Makefile itself. The fhp.mk is devided in 12 main parts,
which are:
- Setting the default values,
- Extra defines for commercial/universtiy version,
- System dependent variables and parameter,
- System dependent variables for the parallel targets,
- Build all directory names, file names and file lists,
- Define commands frequently used in implicit rules,
- Implicit rules,
- General targets,
- Specific rules for target SX4SHM,
- Specific rules for selected inlining,
- Target: Build a deliver version and library,
- Additional dependencies.
Default values
The first
lines give a brief description of how to compile
FASTEST3D with this Makefile and sets the default directories
and makes that the default FHPSYSTEM is set to SOL2
with the default target (DEFTARGET). You can define the
FHPTMPDIR diffrent to the default of /tmp, change
the default MPIROOTDIR, which is set to
/usr/local/mpi. Furthermore You can change the root
directory of the PVM package, its default is
/usr/local/pvm.
Extra defines for commercial/universtiy version
In case of a licensed version of FASTEST3D the extradefines
target XTRADEF is build. (At the FnB we do not use
such a version, so that XTRADEF allways will be empty.)
System dependent variables and parameters
In this section you find the definitions for the compiler respective
the issued FHPSYSTEM and FPHTARGET. The executable
you are compiling will have a basename which is defined to
PROGRAMM=fhp. The flags which are set are described in the
following:
- SYSNAME: Here you see which ending will be appended to
your executable, for example x86gnu.
- DEFTARGET: This will set the DEFault TARGET, for
example fast.
- USECPP: Can be set FALSE or TRUE. If
it is set on true a preprocessing of all '.F' files is forces before
any of the '.f' files is compiled.
- MOVEFOBJS: Can be set FALSE or TRUE.
If it is set true the compiled files will be moved to the proper
cpp-dirrectory, for example from OBJDIRFAST directory to
the CPPDIR. This depends on what you are compiling: A
fast, profiler, debug or a parallel version of FASTEST3D.
- MOVECOBJS: See MOVEFOBJS.
- USEINLINE: Can be set TRUE or FALSE.
If this is set true all the files listed in FSRCI (see
section 3.5.2) will be inlined into the calling routine (to
have less function or subroutine calls
faster).
- AUTOINLINE: Can be set TRUE or FALSE.
Only false is implemented, therefore I do not know the meaning of
this option.
- EXTRAPAROBJS: Can be set TRUE or
FALSE. Setting it true will change the path to the object
files, i. e. the fast object directory will be changed from
objfst to objpar. The other directories
respectively. Further it will set some parallel options.
- FCPAR: This is the fortran compiler, which will be used
when
EXTRAPAROBJS=TRUE.
- FFLAGSPAR: This is the same as FFLAGSFAST only
for EXTRAPAROBJS=TRUE.
- FFLAGSPARPRF: This is the same as FFLAGSPROF
only for EXTRAPAROBJS=TRUE.
- FFLAGSPARDBG: This is the same as FFLAGSDEBUG
only for EXTRAPAROBJS=TRUE.
- CFLAGSPAR: This is the same as CFFLAGSFAST
only for EXTRAPAROBJS=TRUE.
- CFLAGSPARPRF: This is the same as FFLAGSPROF
only for EXTRAPAROBJS=TRUE.
- CFLAGSPARDBG: This is the same as FFLAGSDEBUG
only for EXTRAPAROBJS=TRUE.
- CCPAR: This is the C compiler, which will be used when
EXTRAPAROBJS=TRUE.
- FFLAGOBJNAM: This flag sets the switch for producing an
output file, for example -o.
- FDEFINES: The FDEFINES will define macros for
preprocessing of fortran files. If this is set to -DGNU
the preprocessor is going to search the source code for
ifdef GNU and the corresponding endif. All code
between these marks will be inlined, all other ifdef -
endif constructs will be ignored.
- CPPDFLAGS: Preprocessor flags.
-traditional-cpp will use the old-fashioned C behavior,
-P will not inline #-lines with line-number information
in the output, -M will give a list of dependencies which
have to be satisfied before compiling the actual file (see section
"Define commands frequently used in implicit rules"). Then
make knows which #inlude is newer than the
compiled one. For more information see man cpp.
- CPPD: This is the compiler for dependency things, for
example gcc.
- CPPDTYP: This flag set the command for dependency
things, for example CPPGNU. If the CPPTYP=CPPGNU
you the gcc preprocessor is used. This means that the
output of the gcc is 'file.F.o' an not 'file.o'. Therefore
the entries in the '.d' files have to be modified (by sed).
- CPPFLAGS: Extra flag to give to the C preprocessor amd
programs that use it (the C and Fortran compilers ), for example
-traditional-cpp -E -P.
- CPP: Programm for running the C preprocessor, with
results to standard output, for example gcc.
- CPPTYP: This flag set the command for preprocessing
Fortran source files with C includes (CPPGNU).
- MACHOPT: Not used.
- EXPSUB: Only used for USEINLINE=TRUE. Didn't
got the meaning, sorry.
- EXPFILE: Only used for USEINLINE=TRUE. Didn't
got the meaning, sorry.
- FFLAGSFAST: A flag for compiling the fast version of
FASTEST3D, for example -Wall -O2 -fno-automatic
-ffast-math -traditional-cpp.
- FFLAGSPROF: A flag for the profiler version of
FASTEST3D, for example -pg $(FFLAGSFAST).
- FFLAGSDEBUG: A flag for the debug version of
FASTEST3D, for example -g -Wall -traditional-cpp
-c.
- FC: Program for compiling or preprocessing Fortran
programs, for example g77.
- CDEFINES: The CDEFINES will define macros for
preprocessing of C files. If this is set to -DGNU the
preprocessor is going to search the source code for
ifdef GNU and the corresponding endif. All code
between these marks will be inlined, all other ifdef -
endif constructs will be ignored.
- CFLAGSFAST: See FFLAGSFAST, for example
-c.
- CFLAGSPROF: See CFLAGSPROF, for example
-pg $(CFLAGSFAST).
- CFLAGSDEBUG: See CFLAGSDEBUG, for example
-g -c.
- CC: What ist your C-compiler, for example
gcc.
- LIBS: Specify the library libname.a to be
searched by the linker for the fast version of FASTEST3D,
for example -lmpi, where mpi is the name
of the library (libmpi.a).
- LIBSPROF: Specifies the library for the profiler
version of FASTEST3D, mostly the same as LIBS.
- LIBSPAR: Specifies the library for the parallel
version of FASTEST3D.
- LIBSPARPROF: Specifies the library for the parallel
profiler version of FASTEST3D, mostly the same as
LIBSPAR.
- LDFLAGSFAST: Extraflags for the fast version of
FASTEST3D to give to the compiler when they are supposed to
invoke the linker, 'ld'.
- LDFLAGSPROF: Extraflags for the profiler version of
FASTEST3D to give to the compiler when they are supposed to
invoke the linker, 'ld', for example -pg.
- LDFLAGSDEBUG: Extraflags for the debug version of
FASTEST3D to give to the compiler when they are supposed to
invoke the linker, 'ld'.
- LDFLAGSPAR: Extraflags for the parallel version of
FASTEST3D to give to the compiler when they are supposed to
invoke the linker, 'ld'.
- LDFLAGSPARPRF: The same as LDFLAGSPROF only
for EXTRAPAROBJS=TRUE, for example -pg.
- LDFLAGSPARDBG: The same as LDFLAGSDEBUG only
for EXTRAPAROBJS=TRUE.
- LINK: Which program will be used for linking, for
example g77.
- LINKPAR: Which program will be used for linking of the
parallel version, for example mpif77.
System dependent variables for the parallel targets
If no FHPTARGET was specified the default target
DEFTARGET will be choosen. If this default target is one of
the following:
- parallel,
- parprof or
- pardbg
it will be compiled a parallel version of FASTEST3D. Then
the specific communication libraries and include directories will be
set for the defined FHPSYSTEM.
Directory names, file names and file lists
First the file list of to be compiled files is included (see section
3.5.2). Then all used directories are defined. There are source
and include directories for Fortran and C code. Further the
directories for the dependencies, project specific parts, debug,
parallel and fast versions are set. All object directories are
defined.
In the part "Directory lists" you find the lists for include options
while compiling and preprocessing.
In "file lists" the object file and the dependency file are made
dependent of the source file and the include files. For
example SRCFILES:%.F=$(DEPDIR)%.d means that all Fortran
objectfiles will depend on the Fortran SRCFILES and its
dependency files which resides in DEPDIR. For more
information see the GNU make Manual chapter 4 "Writing Rules".
In "Variable for additional dependencies of the executable" all .F
files will be preprocessed before any .f file is compiled, when the
USECPP is TRUE.
The basename of the executable is set to fhp and its
extension will be set respective the FHPSYSTEM.
frequently used commands in implicit rules
Here you read how the dependencies are build. The dependencies are
build by doing a preprocessor run (for instance gcc) with
dependency flags (for example -M -E -P means that there is
only the output of object files with path and include files with
path). The sed command translates the output to that maner
that the dependency file also is part of the target. Further the '.F'
file and the inside the '.F' file mentioned includes are listed as
dependencies and written in the '.d' files.
All this dependency stuff is done for different CPPDTYPs and
different source files ('.F', '.c' files, project dependent source
code and special comunication libraries). The easiest way of
understanding these rules is to read the part of
CPPDTYP=DEFAULT.
The next part is a set of commands and definitions to compile '.F'
files, not preprocess. There are definitions for fast version of
FASTEST3D, debug version, parallel version, profiler version
and other special versions.
This section is followed by a definition set for preprocessing the
Fortran files.
Implicit Rules
The "Implicit rules" section defines the rules how to create the
dependencies mentioned above in the "frequently used commands in
implicit rules" section. There are rules to create Fortran, C and
func*.F dependencies. Later these dependencies are used to compile
the source code (look for "Implicit rules for compiling C source
files" and "preprocessing and compiling of object files for fast/debug
version").
General targets
The first target .PRECIOUS is a
special target. It prevents that preprocessed files will be deleted
even if the make run was interupted. Then you find the
FHPTARGETS you can issue, if you do not want to use the
default target:
- default
- all
- allpar
- fast
- debug
- prof
- parallel
- parprof
- pardbg
Depending on the specified target the object directories are created,
if not already exist. And after this the specified executable is
going to be linked assumed that all object files exist and are up to
date.
There also is a clean target, which you have to call with the
same options as you compiled the code. For example you compiled the
code by typing:
make -f fhp.mk FHPSYSTEM=GNU FHPTARGET=fast
you can clean this code by typing:
make -f fhp.mk FHPSYSTEM=GNU FHPTARGET=fast clean or
make -f fhp.mk FHPSYSTEM=GNU FHPTARGET=clean or
make -f fhp.mk FHPSYSTEM=GNU clean
Specific Rules For Target SX4SHM
If you are compiling for a SX4SHM platform you will have to use some
special flags for compiling some of the cal*.F files. These
flags only are used for this platform and are called
FFLAGSFASTA and FFLAGSPROFA. These flags are used
like the other fortran compiling flags but only for these special
files:
- calcp.F
- calcdp.F
- calcc.F
- calcke.F
- caluvw.F
All other platforms will be compile the above mentioned files with the
known flags FFLAGSFAST and FFLAGSPROF.
Specific Rules For Selected Inlining
For USEINLINE=TRUE you find here some special rules to
compile a inlined FASTEST3D. The idea of inlining a function
or a subroutine is to have less function and subroutine calls which
are time expensive. But to inline a function or subroutine you need
to compile it in a special way, done here.
Target: Build A Deliver Version And Library
If the DELIVER flag is set TRUE a special Makefile
will be included. This Makefile resides in
deliver/fhpdeliver.unix.mk. I did not see this file at any
time. So I can not tell you anything about it. Even the
DELIVER flag is not implemented at all.
Additional Dependencies
All obove mentioned dependency files are included now. Further in
case of USEINLINE is TRUE there is a amount of
Fortran files which will be inlined too and which also will be
considered for the dependencies like the DEPFILES.