[modes]
modes = tests-gnu tests-gnu-debug
        tests-intel tests-intel-debug
        fury-static-gnu fury-shared-gnu
        fury-static-intel fury-shared-intel

[common-variables]
$CSHARED_GNU = -c -fPIC -frealloc-lhs
$CSHARED_INT = -c -fpic -assume realloc_lhs
$LSHARED     = -shared
$CSTATIC_GNU = -c -frealloc-lhs -std=f2008 -fall-intrinsics
$CSTATIC_INT = -c -assume realloc_lhs -standard-semantics -std08
$DEBUG_GNU   = -O0 -g3 -Warray-bounds -Wcharacter-truncation -Wline-truncation -Wimplicit-interface -Wimplicit-procedure -Wunderflow -fcheck=all -fmodule-private -ffree-line-length-132 -fimplicit-none -fbacktrace -fdump-core -finit-real=nan
$DEBUG_INT   = -O0 -debug all -warn all -extend-source 132 -traceback
$OPTIMIZE    = -O2
$EXDIRS      = BeFoR64/src/tests BeFoR64/src/third_party
               FACE/src/tests
               FLAP/src/tests FLAP/src/third_party
               PENF/src/tests
               StringiFor/src/tests StringiFor/src/third_party

# main modes
[tests-gnu]
template  = template-static-gnu
build_dir = exe

[tests-gnu-debug]
template  = template-static-gnu-debug
build_dir = exe

[tests-intel]
template  = template-static-intel
build_dir = exe

[tests-intel-debug]
template  = template-static-intel-debug
build_dir = exe

[fury-static-gnu]
template  = template-static-gnu
build_dir = lib
target    = fury.f90
output    = libfury.a
mklib     = static

[fury-shared-gnu]
template  = template-shared-gnu
build_dir = lib
target    = fury.f90
output    = libfury.so
mklib     = shared

[fury-static-intel]
template  = template-static-intel
build_dir = lib
target    = fury.f90
output    = libfury.a
mklib     = static

[fury-shared-intel]
template  = template-shared-intel
build_dir = lib
target    = fury.f90
output    = libfury.so
mklib     = shared

# templates
[template-static-gnu]
compiler        = gnu
exclude_dirs    = $EXDIRS
src             = src/
cflags          = $CSTATIC_GNU $OPTIMIZE
lflags          = $OPTIMIZE
cflags_heritage = True
colors          = True
quiet           = False
log             = True
jobs            = 10
preproc         = -D_R16P_SUPPORTED

[template-static-gnu-debug]
compiler        = gnu
exclude_dirs    = $EXDIRS
src             = src/
cflags          = $CSTATIC_GNU $DEBUG_GNU
lflags          = $DEBUG_GNU
cflags_heritage = True
colors          = True
quiet           = False
log             = True
jobs            = 10
preproc         = -D_R16P_SUPPORTED

[template-shared-gnu]
compiler        = gnu
exclude_dirs    = $EXDIRS
src             = src/
cflags          = $CSHARED_GNU $OPTIMIZE
lflags          = $LSHARED $OPTIMIZE
cflags_heritage = True
colors          = True
quiet           = False
log             = True
jobs            = 10
preproc         = -D_R16P_SUPPORTED

[template-static-intel]
compiler        = intel
exclude_dirs    = $EXDIRS
src             = src/
cflags          = $CSTATIC_INT $OPTIMIZE
lflags          = $OPTIMIZE
cflags_heritage = True
colors          = True
quiet           = False
log             = True
jobs            = 10
preproc         = -D_R16P_SUPPORTED

[template-static-intel-debug]
compiler        = intel
exclude_dirs    = $EXDIRS
src             = src/
cflags          = $CSTATIC_INT $DEBUG_INT
lflags          = $DEBUG_INT
cflags_heritage = True
colors          = True
quiet           = False
log             = True
jobs            = 10
preproc         = -D_R16P_SUPPORTED

[template-shared-intel]
compiler        = intel
exclude_dirs    = $EXDIRS
src             = src/
cflags          = $CSHARED_INT $OPTIMIZE
lflags          = $LSHARED $OPTIMIZE
cflags_heritage = True
colors          = True
quiet           = False
log             = True
jobs            = 10
preproc         = -D_R16P_SUPPORTED

# rules
[rule-makedoc]
help   = Rule for building documentation from source files
rule_1 = rm -rf doc/html/*
rule_2 = ford doc/main_page.md --debug
rule_3 = cp -r doc/html/publish/* doc/html/

[rule-makecoverage]
help   = Rule for performing coverage analysis
rule_1 = FoBiS.py clean -mode tests-gnu
rule_2 = FoBiS.py build -mode tests-gnu -coverage
rule_3 = ./run_tests.sh
rule_4 = rm -f exe/obj/penf* exe/obj/stringifor*
rule_5 = gcov -o exe/obj/ src/lib/fury*
rule_6 = gcovr -r . --xml-pretty -o shippable-coverage.xml
rule_7 = rm -f *.gcov

[rule-coverage-analysis]
help   = Rule for performing coverage analysis and saving reports in markdown
rule_1 = FoBiS.py clean -mode tests-gnu
rule_2 = FoBiS.py build -mode tests-gnu -coverage
rule_3 = ./run_tests.sh
rule_4 = rm -f exe/obj/penf* exe/obj/stringifor*
rule_5 = gcov -o exe/obj/ src/lib/fury*
rule_6 = FoBiS.py rule -gcov_analyzer wiki/ Coverage-Analysis
rule_7 = rm -f *.gcov
