fake [version 5.21] Documentation
fake.bash is a shell-script program that creates a Makefile for the compilation of (perhaps large and complex) Fortran programs. The main purpose of fake is to create a Makefile that reflects all the dependencies among source-code (.f, .f77, .f90, etc.) files on the one hand, and the object (.o) and module (.mod) files generated from them on the other. A main feature of the Makefiles generated by fake.bash is that they avoid spurious recompilation cascades that result when a module file is incorrectly assumed to have changed because the source file containing it has been updated. Manual creation and maintenance of a complex Makefile of this kind is a laborious and error-prone chore. Hence the need for the fake.bash program.
Five files must be copied into the user's filesystem: fake.bash, fake-color.bash, mac.bash, mal.bash, and srcs.bash. All scripts should be kept in one directory, that may be anywhere in your filesystem. A separate script, example.bash, is to be manually customized (see below) for each Fortran project; hence, it is suggested that it be copied into a directory that is proximate to the project's source files.
Here the name example.bash will be used to throughout as a reference, but the script can take on whatever name the user desires.
Before running a example.bash, it must be edited to customize it for the project at hand. Twelve variables must be set:
ROOT_DIR is the root directory of the project. ROOT_DIR should contain all directories to be searched for project files (for a single directory project this may simply be ".").
BASH_DIR is the directory that fake.bash, fake-color.bash, mac.bash, mal.bash, and srcs.bash reside in (likely static).
MAKE_DIR is the directory where the Makefile will be generated and the executable will be created (typically ".").
FC is the command used to run your Fortran compiler of choice.
FFLAGS is a list of the flags you would like to use with your Fortran compiler.
CC is the command used to run your C/C++ compiler of choice.
CFLAGS is a list of the flags you would like to use with your C/C++ compiler.
XC is the command used to perform linking compilation (compile your executable from object files).
XFLAGS is a list of flags you would like to use when linking your .o files.
PSRC is the source file containing the PROGRAM block (or 'main' function) of the executable to be built
XNAME is the name of the executable to be created.
After all of these variables are set inside example.bash (all located at the top of the file), you can run example.bash to generate the Makefile based on the source files specified. After which you can type 'make' from the project directory to compile and build your executable.
IMPORTANT: example.bash should be re-run to update the Makefile anytime one of the following occurs:
1. A new source-code file is added to the project, or an existing one is moved/deleted.
2. A MODULE is added to or removed from an existing source file.
3. A USE statement is added to or removed from an existing source file.
4. An INCLUDE statement is added to or removed from an existing source file.
5. The location of fake.bash, fake-color.bash, mac.bash, mal.bash, and srcs.bash in the filesystem.
fake.bash contains two optional features.
1. Color output can be generated when running fake.bash by setting the FAKE_COLOR environment variable to "on". In bash this can be done with the command:
FAKE_COLOR="on"; export FAKE_COLOR
The default colors can be set by assigning the following variables:
The color variables can set to the following values:
2. Notifications can be enabled when running fake.bash by setting the FAKE_NOTIFY environment variable to "on". In bash this can be done with the command:
FAKE_NOTIFY="on"; export FAKE_NOTIFY