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:


Default values

The first $ 160$ 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:


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:

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:

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:

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.