Test forbear for inexperienced guy.
manually download and build
download
To download all the available releases and utilities (fobos, license, readme, etc...), it can be convenient to clone whole the project:
git clone https://github.com/szaghi/forbear
cd forbear
git submodule update --init
Alternatively, you can directly download a release from GitHub server, see the ChangeLog.
build
The most easy way to compile forbear is to use FoBiS.py within the provided fobos file.
Consequently, it is strongly encouraged to install FoBiS.py.
| Build by means of FoBiS | Build by means of GNU Make | Build by means of CMake |
build by means of FoBiS
FoBiS.py is a KISS tool for automatic building of modern Fortran projects. Providing very few options, FoBiS.py is able to build almost automatically complex Fortran projects with cumbersome inter-modules dependency. This removes the necessity to write complex makefile. Moreover, providing a very simple options file (in the FoBiS.py nomenclature indicated as fobos
file) FoBiS.py can substitute the (ab)use of makefile for other project stuffs (build documentations, make project archive, etc...). forbear is shipped with a fobos file that can build the library in both static and shared forms and also build the Test_Driver
program. The provided fobos file has several building modes.
listing fobos building modes
Typing:
the following message should be printed:
The fobos file defines the following modes:
- "shared-gnu"
- "static-gnu"
- "test-driver-gnu"
- "shared-gnu-debug"
- "static-gnu-debug"
- "test-driver-gnu-debug"
- "shared-intel"
- "static-intel"
- "test-driver-intel"
- "shared-intel-debug"
- "static-intel-debug"
- "test-driver-intel-debug"
The modes should be self-explicative: shared
, static
and test-driver
are the modes for building (in release, optimized form) the shared and static versions of the library and the Test Driver program, respectively. The other 3 modes are the same, but in debug form instead of release one. -gnu
use the GNU gfortran
compiler while -intel
the Intel one.
building the library
The shared
or static
directories are created accordingly to the form of the library built. The compiled objects and mod files are placed inside this directory, as well as the linked library.
release shared library
FoBiS.py build -mode shared-gnu
release static library
FoBiS.py build -mode static-gnu
debug shared library
FoBiS.py build -mode shared-gnu-debug
debug static library
FoBiS.py build -mode static-gnu-debug
After this procedure, then you need to build the project to show the effect of forbear
wm@vampire:~/playground/example/forbear$ FoBiS.py build
Builder options
Directories
Building directory: "shared"
Compiled-objects .o directory: "shared/obj"
Compiled-objects .mod directory: "shared/mod"
Compiler options
Vendor: "gnu"
Compiler command: "gfortran"
Module directory switch: "-J"
Compiling flags: "-cpp -c -fPIC -frealloc-lhs -O3 -DUCS4_SUPPORTED -DASCII_SUPPORTED"
Linking flags: "-shared -O3"
Preprocessing flags: "-DUCS4_SUPPORTED -DASCII_SUPPORTED"
Coverage: False
Profile: False
Preprocessor used: None
Preprocessor output directory: None
Preprocessor extensions processed: []
Building src/lib/forbear.f90
Nothing to compile, all objects are up-to-date
Linking shared/libforbear.so
Target src/lib/forbear.f90 has been successfully built
Wrong place to build
wm@vampire:~/playground/Fortran/exercise/fobis$ FoBiS.py build
Attention: the file './FXNqq.f90' depends on 'juicy.m' that is unreachable
Building ./CT14Pdf.for
Compiling ./CT14Pdf.for serially
Warning: compiling file ./CT14Pdf.for fails! Removing from the list of non-module libraries linked into the target!
Builder options
Directories
Building directory: "."
Compiled-objects .o directory: "obj"
Compiled-objects .mod directory: "mod"
Compiler options
Vendor: "intel"
Compiler command: "ifort"
Module directory switch: "-module"
Compiling flags: "-c"
Linking flags: ""
Preprocessing flags: ""
Coverage: False
Profile: False
Preprocessor used: None
Preprocessor output directory: None
Preprocessor extensions processed: []
Building ./MAINqq.f90
Compiling ./FXNqq.f90 ./MC_VEGAS.f90 serially
/bin/sh: 1: ifort: not found
/bin/sh: 1: ifort: not found
/bin/sh: 1: ifort: not found
/bin/sh: 1: ifort: not found
The promotion seems familiar
Aside, I just see that the default behavior of FoBiS is to try to use Intel Fortran: in the next release I will change it making GNU the default one.
So I update my FoBis.py
git pull
cd release/FoBiS-master/
sudo -H python setup.py install
P.S
usage: FoBiS.py build [-h] [-compiler {gnu,intel,g95,opencoarrays-gnu,custom}]
[-fc FC] [-cflags CFLAGS] [-lflags LFLAGS]
[-modsw MODSW] [-mpi] [-openmp] [-coarray] [-coverage]
[-profile] [-mklib {static,shared}] [-ch] [-tb]
[-s SRC [SRC ...]] [-dbld BUILD_DIR] [-dobj OBJ_DIR]
[-dmod MOD_DIR] [-dlib LIB_DIR [LIB_DIR ...]]
[-i INCLUDE [INCLUDE ...]]
[-ed EXCLUDE_DIRS [EXCLUDE_DIRS ...]] [-drs] [-t TARGET]
[-o OUTPUT] [-e EXCLUDE [EXCLUDE ...]]
[-libs LIBS [LIBS ...]] [-vlibs VLIBS [VLIBS ...]]
[-ext_libs EXT_LIBS [EXT_LIBS ...]]
[-ext_vlibs EXT_VLIBS [EXT_VLIBS ...]]
[-dependon DEPENDON [DEPENDON ...]] [-inc INC [INC ...]]
[-extensions EXTENSIONS [EXTENSIONS ...]] [-build_all]
[-f FOBOS] [-fci] [-mode MODE] [-lmodes]
[--print_fobos_template] [-preprocessor [PREPROCESSOR]]
[-p PREPROC] [-dpp PREPROCESSOR_DIR]
[-epp PREPROCESSOR_EXT [PREPROCESSOR_EXT ...]]
[-force_compile] [-colors] [-l] [-graph] [-q] [-verbose]
[-j JOBS] [-m MAKEFILE_name]
Now the default compiler becomes gnu
.
Then I build again
wm@vampire:~/playground/Fortran/exercise/fobis$ FoBiS.py build
Attention: the file './FXNqq.f90' depends on 'juicy.m' that is unreachable
Building ./CT14Pdf.for
Compiling ./CT14Pdf.for serially
Builder options
Directories
Building directory: "."
Compiled-objects .o directory: "obj"
Compiled-objects .mod directory: "mod"
Compiler options
Vendor: "gnu"
Compiler command: "gfortran"
Module directory switch: "-J"
Compiling flags: "-c"
Linking flags: ""
Preprocessing flags: ""
Coverage: False
Profile: False
Preprocessor used: None
Preprocessor output directory: None
Preprocessor extensions processed: []
Building ./MAINqq.f90
Compiling ./FXNqq.f90 ./MC_VEGAS.f90 serially
Compiling ./MAINqq.f90 serially
Linking ./MAINqq
Target ./MAINqq.f90 has been successfully built
Run the executable file ./mainqq
, it works well, and show me the power of FoBiS,py
, it's really convenient to make you get rid of writing MAKEFILE
.
Then back to the question at the beginning, show how forbear
works.
wm@vampire:~/playground/example/forbear/src$ FoBiS.py build
Builder options
Directories
Building directory: "."
Compiled-objects .o directory: "obj"
Compiled-objects .mod directory: "mod"
Compiler options
Vendor: "gnu"
Compiler command: "gfortran"
Module directory switch: "-J"
Compiling flags: "-c"
Linking flags: ""
Preprocessing flags: ""
Coverage: False
Profile: False
Preprocessor used: None
Preprocessor output directory: None
Preprocessor extensions processed: []
Building ./tests/forbear_test.F90
Compiling ./third_party/FACE/src/lib/face.F90 ./lib/forbear_kinds.F90 serially
Compiling ./lib/forbear_element_object.F90 serially
Compiling ./lib/forbear_bar_object.F90 serially
Compiling ./lib/forbear.f90 serially
Compiling ./tests/forbear_test.F90 serially
Linking ./forbear_test
Target ./tests/forbear_test.F90 has been successfully built
Builder options
Directories
Building directory: "."
Compiled-objects .o directory: "obj"
Compiled-objects .mod directory: "mod"
Compiler options
Vendor: "gnu"
Compiler command: "gfortran"
Module directory switch: "-J"
Compiling flags: "-c"
Linking flags: ""
Preprocessing flags: ""
Coverage: False
Profile: False
Preprocessor used: None
Preprocessor output directory: None
Preprocessor extensions processed: []
Building ./third_party/FACE/src/tests/face_test_styles.f90
Compiling ./third_party/FACE/src/tests/face_test_styles.f90 serially
Linking ./face_test_styles
Target ./third_party/FACE/src/tests/face_test_styles.f90 has been successfully built
Builder options
Directories
Building directory: "."
Compiled-objects .o directory: "obj"
Compiled-objects .mod directory: "mod"
Compiler options
Vendor: "gnu"
Compiler command: "gfortran"
Module directory switch: "-J"
Compiling flags: "-c"
Linking flags: ""
Preprocessing flags: ""
Coverage: False
Profile: False
Preprocessor used: None
Preprocessor output directory: None
Preprocessor extensions processed: []
Building ./third_party/FACE/src/tests/face_test_ucs4.F90
Compiling ./third_party/FACE/src/tests/face_test_ucs4.F90 serially
Linking ./face_test_ucs4
Target ./third_party/FACE/src/tests/face_test_ucs4.F90 has been successfully built
Builder options
Directories
Building directory: "."
Compiled-objects .o directory: "obj"
Compiled-objects .mod directory: "mod"
Compiler options
Vendor: "gnu"
Compiler command: "gfortran"
Module directory switch: "-J"
Compiling flags: "-c"
Linking flags: ""
Preprocessing flags: ""
Coverage: False
Profile: False
Preprocessor used: None
Preprocessor output directory: None
Preprocessor extensions processed: []
Building ./third_party/FACE/src/tests/face_test_colors.f90
Compiling ./third_party/FACE/src/tests/face_test_colors.f90 serially
Linking ./face_test_colors
Target ./third_party/FACE/src/tests/face_test_colors.f90 has been successfully built
Builder options
Directories
Building directory: "."
Compiled-objects .o directory: "obj"
Compiled-objects .mod directory: "mod"
Compiler options
Vendor: "gnu"
Compiler command: "gfortran"
Module directory switch: "-J"
Compiling flags: "-c"
Linking flags: ""
Preprocessing flags: ""
Coverage: False
Profile: False
Preprocessor used: None
Preprocessor output directory: None
Preprocessor extensions processed: []
Building ./third_party/FACE/src/tests/face_test_basic.f90
Compiling ./third_party/FACE/src/tests/face_test_basic.f90 serially
Linking ./face_test_basic
Target ./third_party/FACE/src/tests/face_test_basic.f90 has been successfully built
Done!